ret = padd->consumed;
goto out;
}
- PARA_INFO_LOG("consumed total: %lu, first_chunk: %d\n",
- padd->consumed_total, padd->offset[0]);
+// PARA_INFO_LOG("consumed total: %lu, first_chunk: %d\n",
+// padd->consumed_total, padd->offset[0]);
ret = len;
if (padd->consumed_total + len < padd->offset[0])
goto out;
if (padd->consumed_total < padd->offset[0])
padd->consumed = padd->offset[0] - padd->consumed_total;
}
- p = padd->inbuf + padd->consumed;
+ p = memchr(padd->inbuf + padd->consumed, 0x21,
+ padd->inbuf_len - padd->consumed);
+ if (!p) {
+ 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;
+ }
outbuffer = NeAACDecDecode(padd->decoder, &padd->frame_info, p,
len - padd->consumed);
- PARA_INFO_LOG("frame_error: %d, consumed: %lu + %d + %lu\n",
- padd->frame_info.error, padd->consumed_total,
- padd->consumed, padd->frame_info.bytesconsumed);
ret = -E_AAC_DECODE;
if (padd->frame_info.error != 0) {
+ PARA_ERROR_LOG("frame_error: %d, consumed: %lu + %d + %lu\n",
+ padd->frame_info.error, padd->consumed_total,
+ padd->consumed, padd->frame_info.bytesconsumed);
PARA_ERROR_LOG("%s\n", NeAACDecGetErrorMessage(
padd->frame_info.error));
- goto out;
+ padd->consumed++; /* catch 21 */
+ goto success;
}
padd->consumed += padd->frame_info.bytesconsumed;
ret = padd->consumed;
fn->buf[fn->loaded++] = s[i] & 0xff;
fn->buf[fn->loaded++] = (s[i] >> 8) & 0xff;
}
+success:
ret = padd->consumed;
out:
if (ret > 0)