Repository navigation
fix android: detect ADTS before AC-3 syncwords - #611
Merged
Merged
Conversation
AAC payloads can contain 0x0B77, causing whole-file loads to be misclassified as AC-3. Prefer an ADTS header at the start of the input in both file and memory decoding, and cover it with a native regression test.
Owner
|
Thank you! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #610
On Android, valid AAC audio in ADTS framing could be misdetected as AC-3 when its compressed payload contained the byte sequence 0x0B77.
NativeAudioDecoder::decodeMemory() previously searched the entire input for an AC-3/E-AC-3 syncword before checking the ADTS header at the beginning of the input.
This could select BUFFER_AC3 for valid AAC data and attempt to initialize an audio/ac3 decoder, producing:
This PR changes both decodeMemory() and decodeFile() to check for an ADTS header at the start of the input, after an optional ID3 tag, before searching for AC-3/E-AC-3. Genuine AC-3/E-AC-3 detection remains unchanged.
A native regression test was added using the existing sample-AAC.aac fixture with an AC-3-like suffix.
The test verifies that:
Testing:
Type of Change