RT-SILENT-AUDIO-ENDPOINT: serve a silent output endpoint when the host has none (the boot's audio-lock stop) #1598

Merged
aslan2142 merged 2 commits from upstream-pr/1598 into main 2026-11-25 05:32:29 +00:00
aslan2142 commented 2026-11-25 05:31:26 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-11-25T05:31:26Z.


Item: RT-SILENT-AUDIO-ENDPOINT. The claim could not be posted: coordination issue #14 is at GitHub's 2,500-comment limit and has no successor yet. The claim text, to be copied there once there is one:

claiming: RT-SILENT-AUDIO-ENDPOINT - when the host has no audio output, CoCreateInstance(MMDeviceEnumerator) answers render questions with an in-process silent output endpoint (and LEONIDA_AUDIO=silent forces it), so the title's audio start takes its console path

Searched first: no claim or open pull request covers this.

What and why

On a host with no audio output, the title's GetDefaultAudioEndpoint(eRender) returns 0x80070490. Its audio device start then takes an error path that leaves its output-device lock held, and the audio engine never mixes. A main-thread command buffer fills up, and the boot stops on an int3 about 47 s in. Refusing the enumerator altogether gives the same stop. A console always has an output.

Measured on the retail boot first, without code:

  • a diagnostic thread dump showed the engine thread waiting on a lock held by an idle job worker;
  • a private sound server with only a null sink, so still no sound, removed the stop.

CoCreateInstance(MMDeviceEnumerator) now goes to shims/silent_audio.cpp (hooked in shims/com_shim.cpp).

  • A host enumerator that has a render endpoint is returned unchanged.
  • Otherwise, or with the new LEONIDA_AUDIO=silent, render questions get an in-process endpoint that never opens a host device and throws every sample away. It serves:
    • ISpatialAudioClient/2, which is what the title activates: a 7.1 static bed, mono 48 kHz float objects, and an event every 10 ms;
    • IAudioClient/2/3 with render client, clock and volume services.
  • Capture keeps the host's answer.
  • One [rt] line names the reason.
  • Docs: the variable is in runtime/README.md, and the behaviour in docs/runtime_imports.md ("Audio output off the console (WASAPI)").
  • Not measured on a console: 7.1 as the mix format and a bed with 0 dynamic objects. Both are written down as hypotheses.

Tests

  • New silent_audio_test: 129 checks, using stand-in hosts, so no host audio is touched. It covers the enumerator with no endpoint, with one and with none at all; forced mode; event-driven, polled and spatial streams running on their clock; and the hook with LEONIDA_AUDIO=silent.
  • Red check: against main's com_shim.cpp, the hook checks fail.
  • Windows suite under Wine 11.22 (clang-cl build), llvmpipe and an RDNA2 iGPU (RADV): no test goes from pass to fail; silent_audio is new and passes on both.
  • Python checks: test_docs_env_vars, test_docs_links, test_docs_repo_paths, test_ci_registration and test_ctest_registration pass.

Measured on the retail boot

Wine, no audio driver at all, RDNA2 iGPU; counts only. Measured with #1539 merged locally, since RADV loses the device without it. It is not needed to build or merge this.

build run time end D3D12 calls presents
main 48 s the title's int3 about 112k 144
this branch 300 s (time limit) 0 exceptions 135k 367
this branch, LEONIDA_AUDIO=silent 300 s (time limit) 0 exceptions 135k 365

AI-assisted (Claude Code, Claude Opus 5.5).

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5485763493 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1598). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-11-25T05:31:26Z. --- Item: `RT-SILENT-AUDIO-ENDPOINT`. **The claim could not be posted:** coordination issue #14 is at GitHub's 2,500-comment limit and has no successor yet. The claim text, to be copied there once there is one: > claiming: RT-SILENT-AUDIO-ENDPOINT - when the host has no audio output, `CoCreateInstance(MMDeviceEnumerator)` answers render questions with an in-process silent output endpoint (and `LEONIDA_AUDIO=silent` forces it), so the title's audio start takes its console path Searched first: no claim or open pull request covers this. ### What and why On a host with no audio output, the title's `GetDefaultAudioEndpoint(eRender)` returns `0x80070490`. Its audio device start then takes an error path that leaves its output-device lock held, and the audio engine never mixes. A main-thread command buffer fills up, and the boot stops on an `int3` about 47 s in. Refusing the enumerator altogether gives the same stop. A console always has an output. Measured on the retail boot first, without code: - a diagnostic thread dump showed the engine thread waiting on a lock held by an idle job worker; - a private sound server with only a null sink, so still no sound, removed the stop. `CoCreateInstance(MMDeviceEnumerator)` now goes to `shims/silent_audio.cpp` (hooked in `shims/com_shim.cpp`). - **A host enumerator that has a render endpoint is returned unchanged.** - **Otherwise, or with the new `LEONIDA_AUDIO=silent`,** render questions get an in-process endpoint that never opens a host device and throws every sample away. It serves: - `ISpatialAudioClient`/`2`, which is what the title activates: a 7.1 static bed, mono 48 kHz float objects, and an event every 10 ms; - `IAudioClient`/`2`/`3` with render client, clock and volume services. - **Capture keeps the host's answer.** - **One `[rt]` line names the reason.** - **Docs:** the variable is in `runtime/README.md`, and the behaviour in `docs/runtime_imports.md` ("Audio output off the console (WASAPI)"). - **Not measured on a console:** 7.1 as the mix format and a bed with 0 dynamic objects. Both are written down as hypotheses. ### Tests - **New `silent_audio_test`:** 129 checks, using stand-in hosts, so no host audio is touched. It covers the enumerator with no endpoint, with one and with none at all; forced mode; event-driven, polled and spatial streams running on their clock; and the hook with `LEONIDA_AUDIO=silent`. - **Red check:** against `main`'s `com_shim.cpp`, the hook checks fail. - **Windows suite under Wine 11.22 (clang-cl build), llvmpipe and an RDNA2 iGPU (RADV):** no test goes from pass to fail; `silent_audio` is new and passes on both. - **Python checks:** `test_docs_env_vars`, `test_docs_links`, `test_docs_repo_paths`, `test_ci_registration` and `test_ctest_registration` pass. ### Measured on the retail boot Wine, no audio driver at all, RDNA2 iGPU; counts only. Measured with #1539 merged locally, since RADV loses the device without it. It is not needed to build or merge this. | build | run time | end | D3D12 calls | presents | |---|---|---|---|---| | `main` | 48 s | the title's `int3` | about 112k | 144 | | this branch | 300 s (time limit) | 0 exceptions | 135k | 367 | | this branch, `LEONIDA_AUDIO=silent` | 300 s (time limit) | 0 exceptions | 135k | 365 | AI-assisted (Claude Code, Claude Opus 5.5).
aslan2142 commented 2026-11-25 05:32:32 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-11-25T05:32:32Z.


Merged as a boot-blocker fix: on a host with no audio output, the retail boot now runs past the audio-lock stop at about 47 s (counts in the description).

  • Claim: RT-SILENT-AUDIO-ENDPOINT, in the description, because #14 is full.
  • Who it changes nothing for: hosts with an audio output keep their own enumerator unchanged. Capture always keeps the host's answer.
  • No sound, by construction: the silent endpoint never opens a host device. LEONIDA_AUDIO=silent forces it, for muted test runs.
  • Tests: Windows suite under Wine (llvmpipe and an RDNA2 iGPU), with nothing going from pass to fail; silent_audio_test is new; and a red check against main's com_shim.cpp.
  • Review welcome after the fact, in particular the 7.1 bed and the 0 dynamic objects, which are hypotheses (written down as such in docs/runtime_imports.md).
  • Checked on main c7e82e26e + 018145b33: it merges cleanly; the semantic suite passes (487 files, 6,279 tests, 0 files failed); the 14 docs and writer tests pass; check_no_game_data.py is clean on the 8 changed files.

AI-assisted (Claude Code, Claude Opus 5.5).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7153876336 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1598#issuecomment-7153876336). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-11-25T05:32:32Z. --- Merged as a boot-blocker fix: on a host with no audio output, the retail boot now runs past the audio-lock stop at about 47 s (counts in the description). - **Claim:** `RT-SILENT-AUDIO-ENDPOINT`, in the description, because #14 is full. - **Who it changes nothing for:** hosts with an audio output keep their own enumerator unchanged. Capture always keeps the host's answer. - **No sound, by construction:** the silent endpoint never opens a host device. `LEONIDA_AUDIO=silent` forces it, for muted test runs. - **Tests:** Windows suite under Wine (llvmpipe and an RDNA2 iGPU), with nothing going from pass to fail; `silent_audio_test` is new; and a red check against `main`'s `com_shim.cpp`. - **Review welcome after the fact,** in particular the 7.1 bed and the 0 dynamic objects, which are hypotheses (written down as such in `docs/runtime_imports.md`). - **Checked on `main` `c7e82e26e` + `018145b33`:** it merges cleanly; the semantic suite passes (487 files, 6,279 tests, 0 files failed); the 14 docs and writer tests pass; `check_no_game_data.py` is clean on the 8 changed files. AI-assisted (Claude Code, Claude Opus 5.5).
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
ProjectLeonida/mandy!1598
No description provided.