Repository navigation
fix(android): keep a trimmed WAV extraction exact, release 2.22.0 - #228
Merged
Merged
Conversation
The AAC decoder drops the encoder delay and padding counted from wherever it starts, so after a seek it dropped real audio instead: a trimmed WAV came out ~70 ms short for AAC and over 100 ms for HE-AAC, and shifted. The decoder now keeps them and the range is cut from its output on the audio's own timeline, honouring both ways an MP4 declares the delay (iTunes metadata, edit list). A test checks length and burst positions for full and trimmed extractions.
1 of 7 tasks
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.
Description
A trimmed WAV extraction on Android came out short and shifted: ~70 ms for AAC-LC, over 100 ms for HE-AAC. The AAC decoder drops the encoder delay and padding counted from wherever it starts, so after a seek it threw away real audio instead of the priming.
The decoder now keeps priming and padding, and the range is cut from its output on the audio's own timeline. Both ways an MP4 can declare the delay are handled: iTunes metadata (first sample at 0) and an edit list (first sample before 0, as ffmpeg writes it).
Measured on a Galaxy S942B with clips whose bursts start at exactly 0.6 s and 1.2 s:
macOS gives the same numbers. MP3 trims now have the exact length but are still ~52 ms early: after a seek the MP3 decoder discards two frames and stamps its output by sample count. That was already the case before (75 ms early and short).
Found while testing #225, whose new HE-AAC test fails on Android without this.
Tests
extractAudio to WAV keeps a trimmed range in place(two ~5 KB AAC clips); fails on stable, passes on Android and macOS.Type of Change