Skip to content

fix(audio): loop silent Dolby Atmos beside APAC on tvOS so receivers switch to Atmos - #740

Merged
superuser404notfound merged 2 commits into
superuser404notfound:mainfrom
kristofferR:fix/apac-atmos-output
Oct 12, 2026
Merged

superuser404notfound merged 2 commits into
superuser404notfound:mainfrom
kristofferR:fix/apac-atmos-output

Conversation

@kristofferR

@kristofferR kristofferR commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

Hi, while working on integrating my APAC library into AetherEngine (and other tvOS media players) I noticed you had already implemented an alternative, LibTrueHD. Great work, glad to see so many people all work towards finally getting height channels from our Atmos content!

The most important difference between my library and the current implementation of LibTrueHD here is that only mine triggers Atmos on my soundbar. To solve this I and others like NativePlayer use a silent Atmos track played at same time, works brilliantly. Here's a PR that adds the same here, gets Atmos working for me (confirmed on my TV).

AI summary below.

Summary

TrueHD Atmos rendered to APAC doesn't reach every receiver as Atmos. tvOS sends APAC over HDMI as Dolby MAT, and some sinks show Dolby Atmos for that on their own: in #731, an Apple TV 4K (3rd gen, tvOS 27.0) into a Sonos soundbar reports Dolby Atmos. Others don't.

On my Samsung HW-Q990C soundbar, fed by an Apple TV 4K (2nd gen, tvOS 27.2), APAC plays but the soundbar never shows Atmos. Nothing inside the app shows the difference. AVPlayer plays 12-channel apac, and AVAudioSession reports a MAT format ('mat+') whether the soundbar shows Atmos or not.

This adds an activator that gets such sinks into Atmos.

Ref #731

What changed

  • While the engine's player plays an APAC session on tvOS, a new internal AtmosOutputActivator loops a silent E-AC-3 stream signalled as Dolby Atmos on a second, unmuted AVQueuePlayer. With it, the HW-Q990C shows Atmos from the first frame and keeps it across seeks.
  • It follows currentAVPlayer: the item, the audio selection and timeControlStatus. It plays while the host plays or waits to play an item from a session whose audio is APAC (HLSVideoEngine.audioIsAPAC), and pauses with the host. As soon as the item isn't APAC, it releases the stream, so nothing prerolled competes with other audio.
  • tvOS only. The switch is an HDMI one, and on iOS and macOS a second player would only compete for Now Playing.
  • On a sink that already shows Atmos for APAC, the activator should change nothing, since its stream decodes to digital silence and the output is already Atmos. I haven't had such a sink to confirm that on.
  • The bundled stream, Sources/AetherEngine/Resources/silent-atmos.mp4 (194 KB, 2.016 s):
    • It is 63 identical E-AC-3 frames whose 5.1 core codes no mantissas and turns dither off, so it decodes to digital silence.
    • The frame header carries the TS 103 420 Atmos extension (16 objects), and FFmpeg's MP4 muxer writes the matching dec3 extension from it. AVFoundation reads it as 'ec+3' layers over an 'ec-3' core.
    • No encoder output or programme audio is involved: Scripts/make-silent-atmos.swift writes every bit from ETSI TS 102 366 and TS 103 420.
  • Provenance and licence: the script is from SpatialAudioBridge (scripts/make-silent-atmos.swift, Apache-2.0), where the same file ships with its AtmosOutputActivator. With ffmpeg -c copy -fflags +bitexact, the script reproduces the bundled file byte for byte (checked with FFmpeg 9.0.2). Apache-2.0 is compatible with LGPL-3.0, and as SpatialAudioBridge's author I contribute both files here under this project's licence.
  • formats.md and CHANGELOG.md are updated.

Test plan

  • Device / OS: Apple TV 4K (2nd gen), tvOS 27.2 beta, Samsung HW-Q990C over HDMI.

  • Source media: "2012" from Jellyfin. MKV, HEVC Main 10 4K HDR10, TrueHD Atmos. Sodalite with only objectAudioRendering: .apac(.l714) set.

  • Result: the soundbar's own indicator, read by eye.

    Build Playing After a 60 s skip
    main no Atmos
    main + the same activator in the host app Atmos Atmos
    this PR, no host code Atmos Atmos
  • In-app signals didn't track the indicator, so they can't replace a look at the sink. audioFormat read 'mat+' in every run. outputNumberOfChannels read 2 without the activator, 32 with it attached in the host, and 2 again with this PR.

  • New test: the bundled stream loads from the module bundle and reads as E-AC-3 with 'ec+3' layers.

  • swift test --filter "SpatialAudioBridgeTests|PublicAPIDocumentation|DocumentedConstants" passes, and a generic tvOS Simulator build of the package succeeds.

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.md updated
  • Commit messages follow Conventional Commits (feat(...), fix(...), chore(...))
  • The fix lives in the engine, not in a host-side workaround
  • Public API changes are intentional and documented (none)

APAC played on an Apple TV 4K with an Atmos soundbar, but the soundbar
never showed Atmos. While an APAC session plays on tvOS, the engine now
loops a silent E-AC-3 stream signalled as Dolby Atmos on a second player
beside its own (AtmosOutputActivator), which brings the HDMI output into
Atmos. The 2 s stream is digital silence, written from the E-AC-3 and
object audio specifications by Scripts/make-silent-atmos.swift.
…AC alone

Some sinks show Dolby Atmos for APAC on their own; a Samsung HW-Q990C
does not. Name it, and drop the route channel counts, which did not track
the soundbar's indicator across runs.
@kristofferR kristofferR changed the title fix(audio): APAC lights Atmos on sinks that don't show it on their own fix(audio): loop silent Dolby Atmos beside APAC on tvOS so receivers switch to Atmos Oct 11, 2026
@superuser404notfound
superuser404notfound merged commit 9d4b20c into superuser404notfound:main Oct 12, 2026
4 checks passed
superuser404notfound pushed a commit that referenced this pull request Oct 12, 2026
… player (#740)

AtmosOutputActivator holds an AVQueuePlayer of its own. A media services reset
invalidates it along with the engine's player, but only the engine's was
rebuilt, so after an Apple TV sleep the silent Atmos stream would have played
on a dead object until the app restarted. The reset now detaches and drops the
activator, and the next currentAVPlayer builds a fresh one.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WJcXkGQrMiBPixVEFTSBJS
@superuser404notfound

Copy link
Copy Markdown
Owner

Thank you, Kristoffer, for this and for contributing the stream and the script under the project's licence. Merged in 9d4b20c.

What happened on the way in:

  • Rebased the CHANGELOG entry onto the 7.35.x releases; it now sits under Unreleased › Fixed.
  • Checked the bundled file: Scripts/make-silent-atmos.swift reproduces the E-AC-3 elementary stream byte for byte. With FFmpeg 8.1.1 the MP4 differs only in the mvhd timescale, which is a muxer version difference, not content. It decodes to digital silence.
  • Follow-up in bf7b139: the activator holds an AVQueuePlayer of its own, and a media services reset (The engine cannot tell that the media server went away underneath it, and never recovers from it #597) invalidates it along with the engine's player, which the engine already rebuilds. The reset now drops the activator too, so the next session builds a fresh one instead of looping on a dead player after an Apple TV sleep. Pinned by a test in Issue597MediaServicesResetTests.

Before the next release this gets a device round on an Apple TV into a Sonos, a sink that already shows Atmos for APAC on its own, to confirm the activator changes nothing there and leaves Now Playing and the remote alone. I will report back here.

@superuser404notfound

Copy link
Copy Markdown
Owner

Device round done: Apple TV 4K (3rd gen) into a Sonos soundbar, a sink that already shows Atmos for APAC on its own, with Sodalite on bf7b139.

  • Atmos shown from the start and after a 60 s skip, as before.
  • Now Playing and the remote's play/pause unaffected.
  • After pause, Apple TV sleep and wake, playback resumed in Atmos.

So on a sink that needs no nudge the activator changes nothing, as you expected. One side observation, not caused by the activator: after switching from the APAC track to a 5.1 track the Sonos keeps showing Atmos, because tvOS leaves the HDMI output in the MAT carrier it negotiated for APAC (audioRoute output=2). The 5.1 plays correctly inside it. A diagnostic build confirmed the activator released its stream one second after the switch and stayed released.

Thanks again, this goes out with the next release.

@DrHurt

DrHurt commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

I don’t know how I feel about this!

Playing a silent Atmos track to force the receiver to show Atmos light / indicator is deceptive.

If the height channels are working with APAC without the “Atmos” indicator, then all this does is add a deceptive Atmos indicator where the height effects are coming from a different non-Atmos path (ie APAC over Dolby MAT).

All this does is allow some apps to falsely claim “TrueHD Atmos” when it’s not true and it’s actually a silent lossy Atmos track that’s playing and the actual audible sound is coming from the Dolby MAT track.

My opinion is, if some hardware doesn’t support Atmos over Dolby MAT, it’s a hardware limitation. Forcing a logo doesn’t change that. Users should get the honest picture and understand their hw limitations.

yucelokan pushed a commit to yucelokan/AetherEngine that referenced this pull request Oct 12, 2026
…maximum

After an APAC session tvOS keeps the HDMI output in the 2-channel MAT carrier
it negotiated, so a 5.1 ec-3 item played next read output=2 and the warning
claimed a downmix while the sink played the 5.1 intact (Apple TV 4K into a
Sonos, max=32, found in the PR superuser404notfound#740 device round). The warning now fires only
when the sink's advertised maximum is below the track's channel count.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WJcXkGQrMiBPixVEFTSBJS
@kristofferR

Copy link
Copy Markdown
Contributor Author

I don’t know how I feel about this!

Playing a silent Atmos track to force the receiver to show Atmos light / indicator is deceptive.

If the height channels are working with APAC without the “Atmos” indicator, then all this does is add a deceptive Atmos indicator where the height effects are coming from a different non-Atmos path (ie APAC over Dolby MAT).

All this does is allow some apps to falsely claim “TrueHD Atmos” when it’s not true and it’s actually a silent lossy Atmos track that’s playing and the actual audible sound is coming from the Dolby MAT track.

My opinion is, if some hardware doesn’t support Atmos over Dolby MAT, it’s a hardware limitation. Forcing a logo doesn’t change that. Users should get the honest picture and understand their hw limitations.

That's not how it works at all, without the silent Atmos track no height channels are being played at all. It's not about getting some logo lol, it's about getting spatial sound output.

@DrHurt

DrHurt commented Oct 12, 2026

Copy link
Copy Markdown
Contributor

I don’t know how I feel about this!
Playing a silent Atmos track to force the receiver to show Atmos light / indicator is deceptive.
If the height channels are working with APAC without the “Atmos” indicator, then all this does is add a deceptive Atmos indicator where the height effects are coming from a different non-Atmos path (ie APAC over Dolby MAT).
All this does is allow some apps to falsely claim “TrueHD Atmos” when it’s not true and it’s actually a silent lossy Atmos track that’s playing and the actual audible sound is coming from the Dolby MAT track.
My opinion is, if some hardware doesn’t support Atmos over Dolby MAT, it’s a hardware limitation. Forcing a logo doesn’t change that. Users should get the honest picture and understand their hw limitations.

That's not how it works at all, without the silent Atmos track no height channels are being played at all. It's not about getting some logo lol, it's about getting spatial sound output.

That definitely makes it worth it then! Looking forward to your DTS:X patch as well.

Thanks for doing this!

@DrHurt

DrHurt commented Oct 12, 2026

Copy link
Copy Markdown
Contributor

By the way, I’m sorry if I came across as disrespectful. Wasn’t my intention. Thanks for your reply and explanation.

@kristofferR

Copy link
Copy Markdown
Contributor Author

By the way, I’m sorry if I came across as disrespectful. Wasn’t my intention. Thanks for your reply and explanation.

No worries! PR submitted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants