summaryrefslogtreecommitdiff
path: root/apps/playback.c
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/playback.c
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/playback.c')
-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;
67#define CODEC_FLAC "/.rockbox/codecs/codecflac.rock"; 67#define CODEC_FLAC "/.rockbox/codecs/codecflac.rock";
68#define CODEC_WAV "/.rockbox/codecs/codecwav.rock"; 68#define CODEC_WAV "/.rockbox/codecs/codecwav.rock";
69 69
70#define AUDIO_WATERMARK 0x70000 70#define AUDIO_WATERMARK (1024*256)
71#define AUDIO_FILE_CHUNK (1024*32) 71#define AUDIO_FILE_CHUNK (1024*32)
72#define AUDIO_INITIAL_CHUNK (1024*1024*2)
72 73
73#define AUDIO_PLAY 1 74#define AUDIO_PLAY 1
74#define AUDIO_STOP 2 75#define AUDIO_STOP 2
@@ -164,6 +165,9 @@ static struct codec_api ci;
164 variable keeps information about whether to go a next/previous track. */ 165 variable keeps information about whether to go a next/previous track. */
165static int new_track; 166static int new_track;
166 167
168/* If we have just started playing, don't fill the whole file buffer. */
169static unsigned int first_bufferfill;
170
167static bool v1first = false; 171static bool v1first = false;
168 172
169static void mp3_set_elapsed(struct mp3entry* id3); 173static void mp3_set_elapsed(struct mp3entry* id3);
@@ -716,6 +720,12 @@ bool audio_load_track(int offset, bool start_play, int peek_offset)
716 break; 720 break;
717 } 721 }
718 722
723 /* Limit buffering size at first run. */
724 if (first_bufferfill && fill_bytesleft >= first_bufferfill) {
725 fill_bytesleft = first_bufferfill;
726 first_bufferfill = 0;
727 }
728
719 track_changed = true; 729 track_changed = true;
720 track_count++; 730 track_count++;
721 i = tracks[track_widx].filepos; 731 i = tracks[track_widx].filepos;
@@ -1153,6 +1163,7 @@ void audio_play(int offset)
1153#endif 1163#endif
1154 paused = false; 1164 paused = false;
1155 playing = true; 1165 playing = true;
1166 first_bufferfill = AUDIO_INITIAL_CHUNK;
1156 queue_post(&audio_queue, AUDIO_PLAY, (void *)offset); 1167 queue_post(&audio_queue, AUDIO_PLAY, (void *)offset);
1157} 1168}
1158 1169