shithub: opus

Download patch

ref: 43c260ba54a3f5c3373df1676322edac574d52f7
parent: 940931e49bbae25592508b6b2309e551e38fb396
author: Jean-Marc Valin <[email protected]>
date: Wed Mar 30 11:46:42 EDT 2011

Implementing bit-stream padding

--- a/src/opus_decoder.c
+++ b/src/opus_decoder.c
@@ -398,6 +398,22 @@
 		if (st->frame_size*count*25 > 3*st->Fs)
 		    return OPUS_CORRUPTED_DATA;
 		len--;
+		/* Padding bit */
+		if (ch&0x40)
+		{
+			int padding=0;
+			int p;
+			do {
+				if (len<=0)
+					return OPUS_CORRUPTED_DATA;
+				p = *data++;
+				len--;
+				padding += p==255 ? 254: p;
+			} while (p==255);
+			len -= padding;
+		}
+		if (len<0)
+			return OPUS_CORRUPTED_DATA;
 		/* Bit 7 is VBR flag (bit 6 is ignored) */
 		if (ch&0x80)
 		{