From b605b2ec2dca75161584778ad58807046dd33cd7 Mon Sep 17 00:00:00 2001 From: Linus Nielsen Feltzing Date: Wed, 31 Jul 2002 06:33:48 +0000 Subject: The low water handling incorrectly loaded too large chunks at the start of a song git-svn-id: svn://svn.rockbox.org/rockbox/trunk@1496 a1c6a512-1295-4272-9138-f99709370657 --- firmware/mpeg.c | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) (limited to 'firmware/mpeg.c') diff --git a/firmware/mpeg.c b/firmware/mpeg.c index 0130be2697..e61f794161 100644 --- a/firmware/mpeg.c +++ b/firmware/mpeg.c @@ -841,18 +841,14 @@ static void mpeg_thread(void) break; } - if(play_pending) - { - amount_to_read = MIN(MPEG_LOW_WATER, free_space_left); - } + /* Read small chunks while we are below the low water mark */ + if(unplayed_space_left < MPEG_LOW_WATER) + amount_to_read = MIN(MPEG_LOW_WATER_CHUNKSIZE, + free_space_left); else - { - if(unplayed_space_left < MPEG_LOW_WATER) - amount_to_read = MIN(MPEG_LOW_WATER_CHUNKSIZE, - free_space_left); - else - amount_to_read = MIN(MPEG_CHUNKSIZE, free_space_left); - } + amount_to_read = MIN(MPEG_CHUNKSIZE, free_space_left); + + /* Don't read more than until the end of the buffer */ amount_to_read = MIN(mp3buflen - mp3buf_write, amount_to_read); /* Read in a few seconds worth of MP3 data. We don't want to -- cgit v1.2.3