diff --git a/libfaad/decoder.c b/libfaad/decoder.c index c04da52..de3b169 100644 --- a/libfaad/decoder.c +++ b/libfaad/decoder.c @@ -276,6 +276,7 @@ long NeAACDecInit(NeAACDecHandle hpDecoder, if ((hDecoder == NULL) || (samplerate == NULL) || (channels == NULL) || (buffer_size == 0)) 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); @@ -327,12 +328,9 @@ long NeAACDecInit(NeAACDecHandle hpDecoder, 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;