summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Nielsen Feltzing <linus@haxx.se>2002-12-05 13:36:08 +0000
committerLinus Nielsen Feltzing <linus@haxx.se>2002-12-05 13:36:08 +0000
commitd199e691e2f732f427d590de2293b925a1ffe16a (patch)
tree50596ba93d681ca2e4195389bc8f03bb2a399b89
parentae08e95099c307f2fa53274fca9c054cce99ef2a (diff)
downloadrockbox-d199e691e2f732f427d590de2293b925a1ffe16a.zip
rockbox-d199e691e2f732f427d590de2293b925a1ffe16a.tar.gz
rockbox-d199e691e2f732f427d590de2293b925a1ffe16a.tar.bz2
rockbox-d199e691e2f732f427d590de2293b925a1ffe16a.tar.xz
Slightly improved swap handling in lowwater situations
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@2944 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--firmware/mpeg.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/firmware/mpeg.c b/firmware/mpeg.c
index b5a594f..400a702 100644
--- a/firmware/mpeg.c
+++ b/firmware/mpeg.c
@@ -1128,15 +1128,20 @@ static bool swap_one_chunk(void)
{
int free_space_left;
int amount_to_swap;
+ int playable_space;
+ playable_space = mp3buf_swapwrite - mp3buf_read;
+ if(playable_space < 0)
+ playable_space += mp3buflen;
+
free_space_left = get_unswapped_space();
if(free_space_left == 0 && !play_pending)
return false;
/* Swap in larger chunks when the user is waiting for the playback
- to start */
- if(play_pending)
+ to start, or when there is dangerously little playable data left */
+ if(play_pending || playable_space < MPEG_LOW_WATER_CHUNKSIZE)
amount_to_swap = MIN(MPEG_LOW_WATER_CHUNKSIZE, free_space_left);
else
amount_to_swap = MIN(MPEG_SWAP_CHUNKSIZE, free_space_left);