changeset 688:43c77973e494 trunk

[svn] - some ringbuffering fixes -- aac+ shouldn't crash now, but more extensive testing will be needed.
author nenolod
date Tue, 20 Feb 2007 06:17:27 -0800
parents 6dd733e046fa
children 9e85901ac6c0
files ChangeLog src/aac/src/libmp4.c
diffstat 2 files changed, 17 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Tue Feb 20 06:11:10 2007 -0800
+++ b/ChangeLog	Tue Feb 20 06:17:27 2007 -0800
@@ -1,3 +1,10 @@
+2007-02-20 14:11:10 +0000  Jonathan Schleifer <js@h3c.de>
+  revision [1460]
+  Revert r1456, this gives problems with some files with broken ID3-Tags.
+  trunk/src/madplug/input.c |    2 +-
+  1 file changed, 1 insertion(+), 1 deletion(-)
+
+
 2007-02-20 13:51:43 +0000  William Pitcock <nenolod@sacredspiral.co.uk>
   revision [1458]
   - remove some pointless bloat
--- a/src/aac/src/libmp4.c	Tue Feb 20 06:11:10 2007 -0800
+++ b/src/aac/src/libmp4.c	Tue Feb 20 06:17:27 2007 -0800
@@ -738,10 +738,19 @@
                          BUFFER_SIZE-buffervalid, file);
             bufferconsumed = 0;
         }
+
         sample_buffer = faacDecDecode(decoder, &finfo, buffer, buffervalid);
+
+        bufferconsumed += finfo.bytesconsumed;
+        samplesdecoded = finfo.samples;
+
         if(finfo.error > 0){
             buffervalid--;
             memmove(buffer, &buffer[1], buffervalid);
+            if(buffervalid < BUFFER_SIZE) {
+               buffervalid +=
+                 vfs_fread(&buffer[buffervalid], 1, BUFFER_SIZE-buffervalid, file);
+	    }
             bufferconsumed = aac_probe(buffer, buffervalid);
             if(bufferconsumed) {
                memmove(buffer, &buffer[bufferconsumed], buffervalid-bufferconsumed);
@@ -750,8 +759,7 @@
             }
             continue;
         }
-        bufferconsumed += finfo.bytesconsumed;
-        samplesdecoded = finfo.samples;
+
         if((samplesdecoded <= 0) && !sample_buffer){
             g_print("AAC: decoded %d samples!\n", samplesdecoded);
             continue;