From 2326beaf391f056d492df2bfb6b79c0e258c059b Mon Sep 17 00:00:00 2001 From: Miika Pekkarinen Date: Fri, 10 Jun 2005 13:43:12 +0000 Subject: 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 --- apps/playback.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/apps/playback.c b/apps/playback.c index a9fb49e888..43e45ca3cf 100644 --- a/apps/playback.c +++ b/apps/playback.c @@ -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); } -- cgit v1.2.3