summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Nielsen Feltzing <linus@haxx.se>2002-11-24 11:49:17 +0000
committerLinus Nielsen Feltzing <linus@haxx.se>2002-11-24 11:49:17 +0000
commit6a240593927f1d9bc02401859f18152a21751664 (patch)
tree0288f7e41c96d20626884de5b91d18a6414d27bf
parent0281125c9846869d8f058c0f7c1b62c468134096 (diff)
downloadrockbox-6a240593927f1d9bc02401859f18152a21751664.zip
rockbox-6a240593927f1d9bc02401859f18152a21751664.tar.gz
rockbox-6a240593927f1d9bc02401859f18152a21751664.tar.bz2
rockbox-6a240593927f1d9bc02401859f18152a21751664.tar.xz
Recording buffer saving mechanism was braindead
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@2881 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--firmware/mpeg.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/firmware/mpeg.c b/firmware/mpeg.c
index f0b4eb8..346c115 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
{