Slightly improved swap handling in lowwater situations

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@2944 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Linus Nielsen Feltzing 2002-12-05 13:36:08 +00:00
parent ae08e95099
commit d199e691e2

View file

@ -1128,6 +1128,11 @@ 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();
@ -1135,8 +1140,8 @@ static bool swap_one_chunk(void)
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);