Here's a version of the patch with the asserts removed so it actually
compiles.

Mike.
--- faad2-2.7.stock/frontend/main.c	2008-09-22 18:55:09.000000000 +0100
+++ faad2-2.7/frontend/main.c	2012-10-05 13:59:19.699009140 +0100
@@ -130,11 +130,18 @@ static int fill_buffer(aac_buffer *b)
 
 static void advance_buffer(aac_buffer *b, int bytes)
 {
-    b->file_offset += bytes;
-    b->bytes_consumed = bytes;
-    b->bytes_into_buffer -= bytes;
-	if (b->bytes_into_buffer < 0)
-		b->bytes_into_buffer = 0;
+    while ((b->bytes_into_buffer > 0) && (bytes > 0))
+    {
+	int chunk = min(bytes, b->bytes_into_buffer);
+	
+	bytes -= chunk;
+	b->file_offset += chunk;
+	b->bytes_consumed = chunk;
+	b->bytes_into_buffer -= chunk;
+
+	if (b->bytes_into_buffer == 0)
+	    fill_buffer(b);
+    }
 }
 
 static int adts_sample_rates[] = {96000,88200,64000,48000,44100,32000,24000,22050,16000,12000,11025,8000,7350,0,0,0};

Reply via email to