summaryrefslogtreecommitdiffstats
path: root/firmware
diff options
context:
space:
mode:
authorLinus Nielsen Feltzing <linus@haxx.se>2005-09-02 07:01:08 +0000
committerLinus Nielsen Feltzing <linus@haxx.se>2005-09-02 07:01:08 +0000
commit051f2cf3de7d6b839dea962f69a898a46f29f678 (patch)
tree8f13bdcd86d1b6724ed846548b4f5b9809b9e19f /firmware
parent60895bc107f5689f19de61828d8ffe0f2f1f59b5 (diff)
downloadrockbox-051f2cf3de7d6b839dea962f69a898a46f29f678.tar.gz
rockbox-051f2cf3de7d6b839dea962f69a898a46f29f678.tar.bz2
rockbox-051f2cf3de7d6b839dea962f69a898a46f29f678.zip
Adjusted the file size calculation when prerecording
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7451 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware')
-rw-r--r--firmware/mpeg.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/firmware/mpeg.c b/firmware/mpeg.c
index 933d02ce8a..cd413d60fd 100644
--- a/firmware/mpeg.c
+++ b/firmware/mpeg.c
@@ -1752,13 +1752,15 @@ static void mpeg_thread(void)
if(is_prerecording)
{
int startpos, i;
+ int level;
/* Go back prerecord_count seconds in the buffer */
startpos = prerecord_index - prerecord_count;
if(startpos < 0)
startpos += prerecording_max_seconds;
- /* Read the mp3 buffer pointer from the prerecord buffer */
+ /* Read the mp3 buffer pointer from the prerecord
+ buffer */
startpos = prerecord_buffer[startpos];
DEBUGF("Start looking at address %x (%x)\n",
@@ -1770,10 +1772,16 @@ static void mpeg_thread(void)
saved_header);
audiobuf_read = startpos + offset;
-
+ if(audiobuf_read >= audiobuflen)
+ audiobuf_read -= audiobuflen;
+
DEBUGF("New audiobuf_read address: %x (%x)\n",
audiobuf+audiobuf_read, audiobuf_read);
+ level = set_irq_level(HIGHEST_IRQ_LEVEL);
+ num_rec_bytes = get_unsaved_space();
+ set_irq_level(level);
+
/* Make room for headers */
audiobuf_read -= MPEG_RESERVED_HEADER_SPACE;
if(audiobuf_read < 0)