int initialized;
int decoder_length;
- int consumed;
long unsigned consumed_total;
long unsigned entry;
int i, ret, skip;
unsigned char *p, *outbuffer;
unsigned char *inbuf = (unsigned char*)input_buffer;
+ size_t consumed = 0;
if (fn->loaded > fn->bufsize * 4 / 5)
return 0;
if (len < 1000 && !*fci->eof)
return 0;
- padd->consumed = 0;
if (!padd->initialized) {
padd->decoder_length = aac_find_esds(inbuf, len, &skip);
ret = -E_AACDEC_INIT;
goto out;
}
- padd->consumed = ret;
+ consumed = ret;
} else {
- padd->consumed += skip;
- p = inbuf + padd->consumed;
+ consumed += skip;
+ p = inbuf + consumed;
ret = -E_AACDEC_INIT;
if (NeAACDecInit2(padd->decoder, p,
padd->decoder_length, &rate,
padd->initialized = 1;
}
if (padd->decoder_length > 0) {
- padd->consumed = 0;
+ consumed = 0;
if (!padd->entry) {
- ret = aac_find_stco(inbuf + padd->consumed,
- len - padd->consumed, &skip);
+ ret = aac_find_stco(inbuf + consumed, len - consumed,
+ &skip);
if (ret < 0) {
ret = len;
goto out;
}
- padd->consumed += skip;
- padd->entry = aac_read_int32(inbuf + padd->consumed);
+ consumed += skip;
+ padd->entry = aac_read_int32(inbuf + consumed);
PARA_INFO_LOG("entry: %lu\n", padd->entry);
}
ret = len;
if (padd->consumed_total + len < padd->entry)
goto out;
if (padd->consumed_total < padd->entry)
- padd->consumed = padd->entry - padd->consumed_total;
+ consumed = padd->entry - padd->consumed_total;
}
- for (; padd->consumed < len; padd->consumed++)
- if ((inbuf[padd->consumed] & 0xfe) == 0x20)
+ for (; consumed < len;consumed++)
+ if ((inbuf[consumed] & 0xfe) == 0x20)
break;
- if (padd->consumed >= len)
+ if (consumed >= len)
goto success;
- p = inbuf + padd->consumed;
+ p = inbuf + consumed;
outbuffer = NeAACDecDecode(padd->decoder, &padd->frame_info, p,
- len - padd->consumed);
+ len - consumed);
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);
+ consumed, padd->frame_info.bytesconsumed);
PARA_ERROR_LOG("%s\n", NeAACDecGetErrorMessage(
padd->frame_info.error));
- padd->consumed++; /* catch 21 */
+ consumed++; /* catch 21 */
goto success;
}
- padd->consumed += padd->frame_info.bytesconsumed;
- ret = padd->consumed;
+ consumed += padd->frame_info.bytesconsumed;
+ ret = consumed;
if (!padd->frame_info.samples)
goto out;
for (i = 0; i < padd->frame_info.samples; i++) {
fn->buf[fn->loaded++] = (s[i] >> 8) & 0xff;
}
success:
- ret = padd->consumed;
+ ret = consumed;
out:
if (ret > 0)
padd->consumed_total += ret;