mp4AudioSpecificConfig mp4ASC;
int initialized;
+ int decoder_length;
unsigned char *inbuf;
int inbuf_len;
int consumed;
padd->inbuf_len = len;
if (!padd->initialized) {
- ret = find_esds(padd);
- if (ret < 0)
- goto out;
-
- p = padd->inbuf + padd->consumed;
- ret = E_AACDEC_INIT;
- if (NeAACDecInit2(padd->decoder, p, ret, &rate, &channels) < 0) {
- PARA_INFO_LOG("header not found, consumed: %d\n",
- padd->consumed);
- goto out;
+ padd->decoder_length = find_esds(padd);
+ if (padd->decoder_length < 0) {
+ ret = NeAACDecInit(padd->decoder, padd->inbuf,
+ padd->inbuf_len, &rate, &channels);
+ if (ret < 0) {
+ ret = E_AACDEC_INIT;
+ goto out;
+ }
+ padd->consumed = ret;
+ } else {
+ p = padd->inbuf + padd->consumed;
+ ret = E_AACDEC_INIT;
+ if (NeAACDecInit2(padd->decoder, p,
+ padd->decoder_length, &rate,
+ &channels) < 0)
+ goto out;
}
fci->samplerate = rate;
fci->channels = channels;
fci->channels);
padd->initialized = 1;
}
- padd->consumed = 0;
- if (!padd->offset_pos) {
+ if (padd->decoder_length > 0) {
+ padd->consumed = 0;
+ if (!padd->offset_pos) {
+ ret = len;
+ if (find_stco(padd) < 0)
+ goto out;
+ }
+ if (padd->offset_pos < padd->noffsets) {
+ fill_offset_table(padd);
+ ret = padd->consumed;
+ goto out;
+ }
+ PARA_INFO_LOG("consumed total: %lu, first_chunk: %d\n",
+ padd->consumed_total, padd->offset[0]);
ret = len;
- if (find_stco(padd) < 0)
+ 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;
}
- if (padd->offset_pos < padd->noffsets) {
- fill_offset_table(padd);
- ret = padd->consumed;
- goto out;
- }
- 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;
outbuffer = NeAACDecDecode(padd->decoder, &padd->frame_info, p,
len - padd->consumed);