From 7fed4a0f359641a5d4db84f18421c019ddda365c Mon Sep 17 00:00:00 2001 From: Linus Nielsen Feltzing Date: Thu, 5 Dec 2002 17:14:35 +0000 Subject: [PATCH] Faster start of playback git-svn-id: svn://svn.rockbox.org/rockbox/trunk@2953 a1c6a512-1295-4272-9138-f99709370657 --- firmware/mpeg.c | 14 ++++++++++---- firmware/mpeg.h | 2 ++ 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/firmware/mpeg.c b/firmware/mpeg.c index c7148ca804..c838546e22 100644 --- a/firmware/mpeg.c +++ b/firmware/mpeg.c @@ -1124,7 +1124,7 @@ static void start_playback_if_ready(void) /* If the filling has stopped, and we still haven't reached the watermark, the file must be smaller than the watermark. We must still play it. */ - if((playable_space >= low_watermark) || + if((playable_space >= MPEG_PLAY_PENDING_THRESHOLD) || !filling || dma_underrun) { DEBUGF("P\n"); @@ -1159,10 +1159,16 @@ static bool swap_one_chunk(void) /* Swap in larger chunks when the user is waiting for the playback to start, or when there is dangerously little playable data left */ - if(play_pending || get_playable_space() < MPEG_LOW_WATER_SWAP_CHUNKSIZE) - amount_to_swap = MIN(MPEG_LOW_WATER_SWAP_CHUNKSIZE, free_space_left); + if(play_pending) + amount_to_swap = MIN(MPEG_PLAY_PENDING_SWAPSIZE, free_space_left); else - amount_to_swap = MIN(MPEG_SWAP_CHUNKSIZE, free_space_left); + { + if(get_playable_space() < low_watermark) + amount_to_swap = MIN(MPEG_LOW_WATER_SWAP_CHUNKSIZE, + free_space_left); + else + amount_to_swap = MIN(MPEG_SWAP_CHUNKSIZE, free_space_left); + } if(mp3buf_write < mp3buf_swapwrite) amount_to_swap = MIN(mp3buflen - mp3buf_swapwrite, diff --git a/firmware/mpeg.h b/firmware/mpeg.h index 2494ae629d..75ec710a37 100644 --- a/firmware/mpeg.h +++ b/firmware/mpeg.h @@ -28,6 +28,8 @@ #define MPEG_LOW_WATER 0x60000 #define MPEG_LOW_WATER_CHUNKSIZE 0x40000 #define MPEG_LOW_WATER_SWAP_CHUNKSIZE 0x10000 +#define MPEG_PLAY_PENDING_THRESHOLD 0x10000 +#define MPEG_PLAY_PENDING_SWAPSIZE 0x10000 struct mpeg_debug {