forked from len0rd/rockbox
Codecs: aac: Improve ADTS stream detection
Captured ADTS streams might start from some garbage data from previous frame. We should check for sync errors even for first frame. Change-Id: I70171298b79713aeedf9fa2e6098a03063487649
This commit is contained in:
parent
fd12225861
commit
d50470bc7d
2 changed files with 34 additions and 22 deletions
|
@ -247,6 +247,7 @@ int32_t NEAACDECAPI NeAACDecInit(NeAACDecHandle hDecoder, uint8_t *buffer,
|
|||
if ((hDecoder == NULL) || (samplerate == NULL) || (channels == NULL))
|
||||
return -1;
|
||||
|
||||
adts.old_format = hDecoder->config.useOldADTSFormat;
|
||||
hDecoder->sf_index = get_sr_index(hDecoder->config.defSampleRate);
|
||||
hDecoder->object_type = hDecoder->config.defObjectType;
|
||||
*samplerate = get_sample_rate(hDecoder->sf_index);
|
||||
|
@ -277,12 +278,9 @@ int32_t NEAACDECAPI NeAACDecInit(NeAACDecHandle hDecoder, uint8_t *buffer,
|
|||
bits = bit2byte(faad_get_processed_bits(&ld));
|
||||
|
||||
/* Check if an ADTS header is present */
|
||||
} else if (faad_showbits(&ld, 12) == 0xfff) {
|
||||
} else if (adts_frame(&adts, &ld) == 0) {
|
||||
hDecoder->adts_header_present = 1;
|
||||
|
||||
adts.old_format = hDecoder->config.useOldADTSFormat;
|
||||
adts_frame(&adts, &ld);
|
||||
|
||||
hDecoder->sf_index = adts.sf_index;
|
||||
hDecoder->object_type = adts.profile + 1;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue