summaryrefslogtreecommitdiff
path: root/firmware/mpeg.c
diff options
context:
space:
mode:
authorLinus Nielsen Feltzing <linus@haxx.se>2002-07-21 07:12:39 +0000
committerLinus Nielsen Feltzing <linus@haxx.se>2002-07-21 07:12:39 +0000
commit54a65f76ce9560a0a9b3ad1afbeb44b84f76d6af (patch)
tree759183bdd50879de5669bfbe95d61a07c0204b20 /firmware/mpeg.c
parentc04f2ac9fd6e6df033aa910dc70345a36c8d9e6f (diff)
MPEG loading latency patch by Hardeep Sidhu
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@1393 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/mpeg.c')
-rw-r--r--firmware/mpeg.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/firmware/mpeg.c b/firmware/mpeg.c
index 857cd67153..70232571b7 100644
--- a/firmware/mpeg.c
+++ b/firmware/mpeg.c
@@ -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);