ignore zero bit when checking for frame start
authorAndre <maan@p133.(none)>
Wed, 10 May 2006 17:19:12 +0000 (19:19 +0200)
committerAndre <maan@p133.(none)>
Wed, 10 May 2006 17:19:12 +0000 (19:19 +0200)
aacdec.c

index 3963bbc..0eab773 100644 (file)
--- a/aacdec.c
+++ b/aacdec.c
@@ -216,17 +216,13 @@ static ssize_t mp4dec(char *inbuffer, size_t len, struct filter_node *fn)
                if (padd->consumed_total < padd->offset[0])
                        padd->consumed = padd->offset[0] - padd->consumed_total;
        }
-       p = memchr(padd->inbuf + padd->consumed, 0x21,
-               padd->inbuf_len - padd->consumed);
-       if (!p) {
-               padd->consumed = padd->inbuf_len;
+       for (; padd->consumed < padd->inbuf_len; padd->consumed++)
+               if ((padd->inbuf[padd->consumed] & 0xfe) == 0x20)
+                       break;
+       if (padd->consumed >= padd->inbuf_len)
                goto success;
-       }
-       if (p != padd->inbuf + padd->consumed) {
-               int skip = p - padd->inbuf + padd->consumed;
-               PARA_DEBUG_LOG("skipping %d bytes in inbuffer\n", skip);
-               padd->consumed += skip;
-       }
+       p = padd->inbuf + padd->consumed;
+//     PARA_NOTICE_LOG("p[0]: %lx\n", (long unsigned) *p);
        outbuffer = NeAACDecDecode(padd->decoder, &padd->frame_info, p,
                len - padd->consumed);
        ret = -E_AAC_DECODE;