From 6a240593927f1d9bc02401859f18152a21751664 Mon Sep 17 00:00:00 2001 From: Linus Nielsen Feltzing Date: Sun, 24 Nov 2002 11:49:17 +0000 Subject: Recording buffer saving mechanism was braindead git-svn-id: svn://svn.rockbox.org/rockbox/trunk@2881 a1c6a512-1295-4272-9138-f99709370657 --- firmware/mpeg.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/firmware/mpeg.c b/firmware/mpeg.c index f0b4eb85c8..346c115d18 100644 --- a/firmware/mpeg.c +++ b/firmware/mpeg.c @@ -471,8 +471,10 @@ static int lowest_watermark_level; /* Debug value to observe the buffer usage */ #ifdef HAVE_MAS3587F static bool is_recording; /* We are recording */ -bool stop_pending; -unsigned long record_start_frame; /* Frame number where recording started */ +static bool stop_pending; +static unsigned long record_start_frame; /* Frame number where + recording started */ +static bool saving; /* We are saving the buffer to disk */ #endif static int mpeg_file; @@ -725,7 +727,7 @@ static void dma_tick(void) if(num_bytes < 0) num_bytes += mp3buflen; - if(mp3buflen - num_bytes < MPEG_LOW_WATER) + if(mp3buflen - num_bytes < MPEG_LOW_WATER && !saving) queue_post(&mpeg_queue, MPEG_SAVE_DATA, 0); } } @@ -1653,6 +1655,7 @@ static void mpeg_thread(void) case MPEG_STOP: DEBUGF("MPEG_STOP\n"); + demand_irq_enable(false); is_recording = false; /* Save the remaining data in the buffer */ @@ -1663,12 +1666,11 @@ static void mpeg_thread(void) case MPEG_STOP_DONE: DEBUGF("MPEG_STOP_DONE\n"); - demand_irq_enable(false); if(mpeg_file >= 0) close(mpeg_file); mpeg_file = -1; -#ifdef DEBUG +#ifdef DEBUG1 { int i; for(i = 0;i < 512;i++) @@ -1703,6 +1705,8 @@ static void mpeg_thread(void) stop_pending) { int rc; + + saving = true; /* Only save up to the end of the buffer */ writelen = MIN(amount_to_save, @@ -1719,6 +1723,10 @@ static void mpeg_thread(void) queue_post(&mpeg_queue, MPEG_SAVE_DATA, 0); } + else + { + saving = false; + } } else { -- cgit v1.2.3