Repository navigation
fix(audio): objects play from the first frame after a seek in TrueHD Atmos - #741
Conversation
…Atmos Decoding resumes at the next major sync after a seek, and the first object metadata follows up to 32 ms later. Until it arrived every object rendered silent, so the APAC carried the LFE alone. The decoder now holds those blocks and releases them with the first metadata's state applied from their first frame, waiting at most 100 ms.
…s at EOF A configuration change rebuilds the renderer without object positions, so the hold re-arms for it instead of passing the new configuration's first blocks straight through. At the end of input no metadata will come for what is held, so the bridge's flush releases it and renders it as it is.
The hold added in #741 keeps up to 100 ms of TrueHD Atmos blocks back after a reset until the first object metadata arrives. settle(), which the producer calls before a cut, only waited for the encode pipeline, so blocks still held at a cut (a decoder self-reset just before one) came out after it and landed in the next segment. settle() now releases and renders them first, so a cut sees what it saw before the hold existed. A release with nothing held leaves the hold armed, so a cut ahead of the first audio after a restart does not switch it off. finishInput() is renamed releaseHeldBlocks(), since end of input is no longer its only caller. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01WJcXkGQrMiBPixVEFTSBJS
|
Thanks a lot for this one, and for the before/after numbers on Nature's Fury, that made it easy to verify. Merged in 7c2cf57 (the CHANGELOG conflict resolved into Unreleased › Fixed), full suite green on both runners. One follow-up on top, c2f70cb: It goes out with the next release. |
Summary
After every seek or producer restart, TrueHD Atmos rendered to APAC plays the LFE alone for a moment. Decoding resumes at the next major sync, but the stream's first object metadata arrives 0 to 38 access units later (up to 32 ms on measured films). Until then the renderer has no position for any object and renders it silent, and in films whose bed is LFE only, that is everything else. This holds those blocks and plays them at the first metadata's positions.
Ref #731
What changed
TrueHDObjectAudioDecoderholds the blocks it decodes between a reset and the first metadata (ObjectMetadataHold). When the payload arrives, it releases them in order, and the first one carries that payload's first state as a jump at frame 0. The payload's own update still applies at its own offset.SpatialAudioBridge.flush()asks the decoder to release whatever it holds (ObjectAudioDecoding.finishInput()) and renders it unchanged.inputFrameOffsetstays per block), so the bridge anchors exactly as before; the served fragments'tfdtvalues are identical with and without the change.Test plan
Device / OS: M-series Mac, macOS 27,
aetherctl serve --atmos-bed 7.1.4.Source media: Dolby's Nature's Fury demo, TrueHD Atmos in MKV, LFE + objects. Cold fetches of seg20 (producer restart at 80.25 s) and seg19 (restart at 76.12 s), decoded with AVAssetReader.
Result: non-LFE energy at the start of seg20:
mainseg19's first 4 ms: −118.8 dB on
main, −30.5 dB with this PR (source −29.0 dB).ObjectMetadataHoldTestscovers:The 100 ms quoted in
formats.mdis pinned inDocumentedConstantsTests.swift test --filter "ObjectMetadataHoldTests|DocumentedConstants|SpatialObjectRenderingTests|SpatialAudioBridgeTests|TrueHDObjectMetadataMapping|PublicAPIDocumentation"passes.This is one of three independent TrueHD Atmos fixes. Each adds an entry under Unreleased › Fixed in
CHANGELOG.md, so whichever merges second needs a one-line rebase there.Checklist
CHANGELOG.mdupdatedfeat(...),fix(...),chore(...))