diff options
author | Roman Artiukhin <bahusdrive@gmail.com> | 2024-01-03 17:30:18 +0200 |
---|---|---|
committer | Solomon Peachy <pizza@shaftnet.org> | 2024-01-21 20:08:04 -0500 |
commit | d50470bc7db942105c3bd774ea08a836b842d58c (patch) | |
tree | 5c5daf1d1f6222955ebc4751a1f41bbbd61e215e /lib/rbcodec/codecs | |
parent | fd12225861ec6fe810ebbfb7c669635e60ecbfc8 (diff) | |
download | rockbox-d50470bc7db942105c3bd774ea08a836b842d58c.tar.gz rockbox-d50470bc7db942105c3bd774ea08a836b842d58c.zip |
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
Diffstat (limited to 'lib/rbcodec/codecs')
-rw-r--r-- | lib/rbcodec/codecs/libfaad/decoder.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/lib/rbcodec/codecs/libfaad/decoder.c b/lib/rbcodec/codecs/libfaad/decoder.c index d68d093b0b..533de50d5b 100644 --- a/lib/rbcodec/codecs/libfaad/decoder.c +++ b/lib/rbcodec/codecs/libfaad/decoder.c | |||
@@ -247,6 +247,7 @@ int32_t NEAACDECAPI NeAACDecInit(NeAACDecHandle hDecoder, uint8_t *buffer, | |||
247 | if ((hDecoder == NULL) || (samplerate == NULL) || (channels == NULL)) | 247 | if ((hDecoder == NULL) || (samplerate == NULL) || (channels == NULL)) |
248 | return -1; | 248 | return -1; |
249 | 249 | ||
250 | adts.old_format = hDecoder->config.useOldADTSFormat; | ||
250 | hDecoder->sf_index = get_sr_index(hDecoder->config.defSampleRate); | 251 | hDecoder->sf_index = get_sr_index(hDecoder->config.defSampleRate); |
251 | hDecoder->object_type = hDecoder->config.defObjectType; | 252 | hDecoder->object_type = hDecoder->config.defObjectType; |
252 | *samplerate = get_sample_rate(hDecoder->sf_index); | 253 | *samplerate = get_sample_rate(hDecoder->sf_index); |
@@ -277,12 +278,9 @@ int32_t NEAACDECAPI NeAACDecInit(NeAACDecHandle hDecoder, uint8_t *buffer, | |||
277 | bits = bit2byte(faad_get_processed_bits(&ld)); | 278 | bits = bit2byte(faad_get_processed_bits(&ld)); |
278 | 279 | ||
279 | /* Check if an ADTS header is present */ | 280 | /* Check if an ADTS header is present */ |
280 | } else if (faad_showbits(&ld, 12) == 0xfff) { | 281 | } else if (adts_frame(&adts, &ld) == 0) { |
281 | hDecoder->adts_header_present = 1; | 282 | hDecoder->adts_header_present = 1; |
282 | 283 | ||
283 | adts.old_format = hDecoder->config.useOldADTSFormat; | ||
284 | adts_frame(&adts, &ld); | ||
285 | |||
286 | hDecoder->sf_index = adts.sf_index; | 284 | hDecoder->sf_index = adts.sf_index; |
287 | hDecoder->object_type = adts.profile + 1; | 285 | hDecoder->object_type = adts.profile + 1; |
288 | 286 | ||