1
0
Fork 0
forked from len0rd/rockbox

MPEG loading latency patch by Hardeep Sidhu

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@1393 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Linus Nielsen Feltzing 2002-07-21 07:12:39 +00:00
parent c04f2ac9fd
commit 54a65f76ce

View file

@ -38,6 +38,7 @@
#define MPEG_SWAP_CHUNKSIZE 0x8000
#define MPEG_HIGH_WATER 2
#define MPEG_LOW_WATER 0x40000
#define MPEG_LOW_WATER_CHUNKSIZE 0x10000
#define MPEG_PLAY 1
#define MPEG_STOP 2
@ -496,6 +497,7 @@ static void mpeg_thread(void)
struct event ev;
int len;
int free_space_left;
int unplayed_space_left;
int amount_to_read;
int amount_to_swap;
@ -676,6 +678,8 @@ static void mpeg_thread(void)
if(free_space_left <= 0)
free_space_left = mp3buflen + free_space_left;
unplayed_space_left = mp3buflen - free_space_left;
/* Make sure that we don't fill the entire buffer */
free_space_left -= 2;
@ -694,7 +698,11 @@ static void mpeg_thread(void)
}
else
{
amount_to_read = MIN(MPEG_CHUNKSIZE, free_space_left);
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(mp3buflen - mp3buf_write, amount_to_read);