fix(playback): stop Firefox AAC crackle after audio transcode - #64
Merged
Conversation
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.
What changed
Firefox no longer receives irregular packet timestamps when Silo converts multichannel audio to stereo AAC.
aresample async=1) to the existing surround-to-stereo AAC recipe.audio_to_aacfrom recipe version 2 to 3 so an older transcode node cannot claim the new byte recipe.Root cause and evidence
I reproduced this on the signed-in production web UI with Firefox 154. It affected both DTS-to-AAC and AAC-to-AAC conversion. The source codec was not the common factor, and the session logs showed no buffering, HTTP failure, corrupt frames, or server-side decoder error.
The generated AAC packets had fixed 21.333 ms durations but inherited sub-frame timestamp jitter from the source:
With the corrected recipe, both sources produce only 21.333/21.334 ms steps, which is the expected rounding for 1,024 AAC samples at 48 kHz.
I also captured decoded PCM from the same failing production position in a clean Firefox profile. Across the same six-second window, unintended zero-run boundaries dropped from 27 to 5 and the largest adjacent-sample delta fell from 0.1035 to 0.0936. RMS level and decoded sample count remained equivalent. Chromium's HLS route was already clean, which is why this was visible only in Firefox's progressive fMP4 route.
This is a shared timestamp-correctness fix rather than a Firefox user-agent workaround. It preserves video stream copy, current quality, existing downmix loudness/headroom, HLS behavior, and browser fallbacks.
Saved-position resume and new streams created after a forward or rewind seek use the same corrected AAC cadence while retaining their requested seek anchor. Direct play and codec-copy remux paths do not receive the audio filter and remain unchanged.
Validation
go test ./internal/playback -run 'Test(BuildRemuxArgsBoostsOnlySurroundToStereoAAC|AppendAudioArgsBoostsOnlyEncodedSurroundToStereo|ProbeTransformationRegistryV3RequiresVersion3AudioFilterGraph|TransformationRegistryWithAdvertised|PlanPlaybackV3AudioAdaptationOffloadsToHLSRemux|PlanPlaybackV3AudioOnlyConvertsUnsupportedCodec)$'go test ./internal/playback -run '(Audio|Remux|Transformation)'go test ./internal/playback -run 'Test(BuildRemuxArgsNormalizesAACAcrossSeekAnchors|BuildRemuxArgsBoostsOnlySurroundToStereoAAC|AppendAudioArgsBoostsOnlyEncodedSurroundToStereo|PlanPlaybackV3DirectPlayNeverConsultsNodeCapabilities|PlanPlaybackV3DirectPlaysH264ConstrainedBaselineWithoutTranscoding)$'The complete local playback-package run reached unrelated sandbox-dependent NVENC/VideoToolbox probe failures; the audio/remux subset passed. GitHub Actions is the full supported-environment gate for this branch.
Related issue: N/A — narrow fix
AI Disclosure
Checklist