Repository navigation
Description
What happened?
I called engine.load() on a DTS 5.1 MKV (native AVPlayer path) with the default audioBridgeMode (.surroundCompat), on an FFmpeg build compiled without --enable-encoder=eac3 (the flac encoder is present). I expected audio to play — via the FLAC bridge if EAC3 re-encode isn't possible.
Instead the session silently fell back to video-only: AudioBridge.init(..., mode: .surroundCompat) throws AudioBridgeError.encoderNotFound, and buildProducerWithAudioCascade makes a single bridge attempt — any thrown error drops straight to the video-only path. Every bridge-required codec (DTS, TrueHD, MP3, Opus, Vorbis, PCM, MP2, LATM-AAC) plays with no audio, and the only signal is one log line.
Two smaller aggravators:
- The routing log line prints a hardcoded
"decoding + FLAC re-encode"label regardless of the actual configured mode (it was EAC3), which misdirects debugging. - The function's doc-comment describes a cascade ("Stream-copy -> FLAC-bridge -> video-only") that the code doesn't implement across bridge modes.
Steps to reproduce
- Build/link FFmpeg without
--enable-encoder=eac3(flac encoder present) - Configure
LoadOptionswith the defaultaudioBridgeMode(.surroundCompat) engine.load(url:)on any DTS or TrueHD MKV- Observe: video plays, no audio; log shows
AudioBridge init failed (AudioBridge: bridge encoder not registered ...), falling back to video-only
AetherEngine version or commit SHA
5.13.0 (verified the same single-attempt code is present at 5.15.0, Video/HLSVideoEngine+AudioRoute.swift)
Host app
Custom / my own integration
Platform
tvOS
OS version
tvOS 26
Device / chip
Apple TV 4K (3rd gen, 2022)
Playback path
Native AVPlayer
Source media (for playback bugs)
MKV, HEVC Main 10, 3840x2160; audio DTS 5.1 (also reproduced with TrueHD/Atmos 7.1 — any requiresBridge == true codec)
Error codes / log lines
[HLSVideoEngine] audio: override accepted, sourceStreamIndex=1 (auto would have picked 1)
[HLSVideoEngine] audio: codec=dts (bridge required), decoding + FLAC re-encode
[HLSVideoEngine] AudioBridge init failed (AudioBridge: bridge encoder not registered (FFmpeg build missing --enable-encoder=flac / --enable-encoder=eac3?)), falling back to video-only
[AetherEngine] published active audio reconciled to the session's real pick: nil (was 1)
(Note the second line's "FLAC re-encode" label is hardcoded — the actual attempted mode was EAC3.)
Anything else
Root cause and a fix are in hand. I have a small patch (~50 lines, Video/HLSVideoEngine+AudioRoute.swift only) that restores a bridge-mode cascade: try the configured mode, catch encoderNotFound, retry .lossless (FLAC), and emit a loud ERROR before any video-only fallback so a missing encoder is never silent. No behavior change when the configured encoder exists (first attempt succeeds as today). Verified on hardware: Apple TV 4K, DTS 5.1 and TrueHD Atmos MKVs over network streams — audio plays via the FLAC bridge after the patch; a downstream client's full unit suite (1038 tests) runs green against it. The patch applies clean to 5.15.0 — happy to open a PR if you want it.
Activity
superuser404notfound commentedon Jul 20, 2026
Fixed in 5.15.4 (just released). Thank you for the exact root cause, the codec-by-codec impact list, and especially the hardware verification, that made this a quick, confident fix, so no PR needed on your side, but the offer was appreciated.
What shipped, matching your patch:
buildProducerWithAudioCascadenow cascades across bridge modes instead of making a single attempt. It tries the configuredaudioBridgeMode, and only onAudioBridgeError.encoderNotFoundfalls through to the other mode's encoder (EAC3 <-> FLAC) before any video-only fallback. Every other init failure is source-specific, so it stops immediately without a pointless retry.ERRORline is now emitted (not a quiet info line) before the silent video-only fallback, so a missing encoder is never invisible.buildProducerWithAudioCascadedoc-comment matches the real routing.The ordering decision is a pure
bridgeModeCascade(configured:)with unit coverage inIssue165BridgeModeCascadeTests; the encoder-absent runtime path itself is not unit-testable since CI's FFmpeg build carries both encoders, so your on-device pass is what proves the end-to-end behavior. Full suite is green (841/841), strict-concurrency clean, tvOS Simulator build succeeds.Release: https://github.com/superuser404notfound/AetherEngine/releases/tag/5.15.4
Closing as fixed; reopen if a build without eac3 still comes up silent on your end.
superuser404notfound commentedon Jul 20, 2026
Reopening to keep this open until you have confirmed the 5.15.4 fix on your end (a build without eac3 now playing via the FLAC bridge). No rush, just did not want to close it out from under your retest.
htrung14 commentedon Jul 20, 2026
htrung14 commentedon Jul 21, 2026
Confirmed fixed on hardware with 5.15.4.
Apple TV 4K (3rd gen), tvOS 26.5, DTS 5.1 source over a network stream, on an FFmpeg build without
--enable-encoder=eac3(flac present). Device log from the run:Before 5.15.4 this went straight to video-only; now the
encoderNotFoundcascade falls through to FLAC and audio plays. The de-hardcoded routing log ("EAC3 re-encode" reflecting the configured mode, then the explicit cascade line) also made this trivial to verify from a log pull. Thanks for the fast turnaround — closing on our end.superuser404notfound commentedon Jul 21, 2026
Thanks for the hardware confirmation and the full device log. That is exactly the cascade path we wanted to see: surroundCompat falling through to lossless on the absent encoder, DTS routed to the FLAC bridge, and the track coming up readyToPlay with audio. Good to hear the de-hardcoded routing lines made the log pull easy to read as well.
Closing as fixed in 5.15.4. Reopen anytime if a build without eac3 ever comes up silent again.
fix(audio): cascade to the alternate bridge encoder when the configur…
fix(audio): the bridge encoder follows the source, not the mode (AE#395)
fix(audio): the bridge encoder opens at a rate it has, not at the sou…
feat(audio): the bridge hands on the decoded PCM, not FLAC; Blu-ray L…