forked from len0rd/rockbox
When selecting first song to play, buffer initially only 2 MiB. If
user continues listening to the same song, then fill the buffer completely. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6651 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
637e313925
commit
2326beaf39
1 changed files with 13 additions and 2 deletions
|
|
@ -67,8 +67,9 @@ static volatile bool paused;
|
|||
#define CODEC_FLAC "/.rockbox/codecs/codecflac.rock";
|
||||
#define CODEC_WAV "/.rockbox/codecs/codecwav.rock";
|
||||
|
||||
#define AUDIO_WATERMARK 0x70000
|
||||
#define AUDIO_FILE_CHUNK (1024*32)
|
||||
#define AUDIO_WATERMARK (1024*256)
|
||||
#define AUDIO_FILE_CHUNK (1024*32)
|
||||
#define AUDIO_INITIAL_CHUNK (1024*1024*2)
|
||||
|
||||
#define AUDIO_PLAY 1
|
||||
#define AUDIO_STOP 2
|
||||
|
|
@ -164,6 +165,9 @@ static struct codec_api ci;
|
|||
variable keeps information about whether to go a next/previous track. */
|
||||
static int new_track;
|
||||
|
||||
/* If we have just started playing, don't fill the whole file buffer. */
|
||||
static unsigned int first_bufferfill;
|
||||
|
||||
static bool v1first = false;
|
||||
|
||||
static void mp3_set_elapsed(struct mp3entry* id3);
|
||||
|
|
@ -716,6 +720,12 @@ bool audio_load_track(int offset, bool start_play, int peek_offset)
|
|||
break;
|
||||
}
|
||||
|
||||
/* Limit buffering size at first run. */
|
||||
if (first_bufferfill && fill_bytesleft >= first_bufferfill) {
|
||||
fill_bytesleft = first_bufferfill;
|
||||
first_bufferfill = 0;
|
||||
}
|
||||
|
||||
track_changed = true;
|
||||
track_count++;
|
||||
i = tracks[track_widx].filepos;
|
||||
|
|
@ -1153,6 +1163,7 @@ void audio_play(int offset)
|
|||
#endif
|
||||
paused = false;
|
||||
playing = true;
|
||||
first_bufferfill = AUDIO_INITIAL_CHUNK;
|
||||
queue_post(&audio_queue, AUDIO_PLAY, (void *)offset);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue