1
0
Fork 0
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:
Miika Pekkarinen 2005-06-10 13:43:12 +00:00
parent 637e313925
commit 2326beaf39

View file

@ -67,8 +67,9 @@ static volatile bool paused;
#define CODEC_FLAC "/.rockbox/codecs/codecflac.rock"; #define CODEC_FLAC "/.rockbox/codecs/codecflac.rock";
#define CODEC_WAV "/.rockbox/codecs/codecwav.rock"; #define CODEC_WAV "/.rockbox/codecs/codecwav.rock";
#define AUDIO_WATERMARK 0x70000 #define AUDIO_WATERMARK (1024*256)
#define AUDIO_FILE_CHUNK (1024*32) #define AUDIO_FILE_CHUNK (1024*32)
#define AUDIO_INITIAL_CHUNK (1024*1024*2)
#define AUDIO_PLAY 1 #define AUDIO_PLAY 1
#define AUDIO_STOP 2 #define AUDIO_STOP 2
@ -164,6 +165,9 @@ static struct codec_api ci;
variable keeps information about whether to go a next/previous track. */ variable keeps information about whether to go a next/previous track. */
static int new_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 bool v1first = false;
static void mp3_set_elapsed(struct mp3entry* id3); 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; 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_changed = true;
track_count++; track_count++;
i = tracks[track_widx].filepos; i = tracks[track_widx].filepos;
@ -1153,6 +1163,7 @@ void audio_play(int offset)
#endif #endif
paused = false; paused = false;
playing = true; playing = true;
first_bufferfill = AUDIO_INITIAL_CHUNK;
queue_post(&audio_queue, AUDIO_PLAY, (void *)offset); queue_post(&audio_queue, AUDIO_PLAY, (void *)offset);
} }