Skip to content

5.15.4

Choose a tag to compare

@superuser404notfound superuser404notfound released this 20 Jul 22:08

Fixed

Audio: cascade to the alternate bridge encoder when the configured one is absent (#165)

On an FFmpeg build compiled without the configured bridge encoder (for example no --enable-encoder=eac3, FLAC present), a bridge-required audio codec played as silent video-only with no cascade to FLAC.

The audio route made a single AudioBridge attempt with the configured audioBridgeMode (default .surroundCompat = EAC3). When that mode's encoder was absent from the build, AudioBridge.init threw .encoderNotFound and the handler dropped straight to silent video-only. Every bridge-required codec (DTS, TrueHD, MP3, Opus, Vorbis, PCM, MP2, LATM-AAC) came up with no audio, and the only signal was one log line.

Fix. The route now cascades: it tries the configured mode and, only on a missing-encoder error, falls through to the other mode's encoder (EAC3 ↔ FLAC) before any video-only fallback. Both modes decode everywhere on Apple devices (EAC3 to the HDMI bitstream tunnel, FLAC to the LPCM route), so either is a valid rescue. Every other init failure is source-specific, so it stops immediately without a pointless retry. A loud ERROR is emitted (not a quiet info line) before the silent video-only fallback so a missing encoder is never invisible.

No behavior change when the configured encoder is present: the first attempt succeeds exactly as before.

Two aggravators fixed alongside:

  • The routing log line hardcoded "decoding + FLAC re-encode" regardless of the configured mode (the default is EAC3), which misdirected debugging; it now reflects audioBridgeMode.
  • The buildProducerWithAudioCascade doc-comment described a cascade the code did not implement across bridge modes; it now matches the real routing.

Reported and hardware-verified by a downstream integrator (Apple TV 4K 3rd gen, tvOS 26; DTS 5.1 and TrueHD Atmos MKVs over network streams, audio plays via the FLAC bridge after the fix). The ordering decision is extracted to a pure bridgeModeCascade(configured:) with unit coverage in Issue165BridgeModeCascadeTests; the encoder-absent runtime path cannot be unit-tested because CI's FFmpeg build carries both encoders.

Full suite 841/841 green, strict-concurrency clean, tvOS Simulator build succeeds.

Full Changelog: 5.15.3...5.15.4