summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorMiika Pekkarinen <miipekk@ihme.org>2005-06-10 13:43:12 +0000
committerMiika Pekkarinen <miipekk@ihme.org>2005-06-10 13:43:12 +0000
commit2326beaf391f056d492df2bfb6b79c0e258c059b (patch)
tree4a4bedb976b1a2ba0dd9c84285a743bb2a3638b7 /apps
parent637e313925779c911a5291748370485948d6ee44 (diff)
downloadrockbox-2326beaf391f056d492df2bfb6b79c0e258c059b.tar.gz
rockbox-2326beaf391f056d492df2bfb6b79c0e258c059b.zip
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
Diffstat (limited to 'apps')
-rw-r--r--apps/playback.c15
1 files 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);
}