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

Closed
opened 2026-11-26 20:21:52 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/1598
Author: @aslan2142
Created: 11/25/2026
Status: ✅ Merged
Merged: 11/25/2026
Merged by: @aslan2142

Base: main ← Head: silent-audio-endpoint


📝 Commits (2)

  • d4ce33e runtime: serve a silent output endpoint when the host has none
  • 018145b runtime: serve the spatial stream on the silent output endpoint

📊 Changes

8 files changed (+2163 additions, -2 deletions)

View changed files

📝 docs/runtime_imports.md (+39 -0)
📝 runtime/CMakeLists.txt (+18 -0)
📝 runtime/README.md (+1 -0)
📝 runtime/shims/com_shim.cpp (+7 -1)
➕ runtime/shims/silent_audio.cpp (+1308 -0)
➕ runtime/shims/silent_audio.h (+61 -0)
➕ runtime/test/silent_audio_test.cpp (+728 -0)
📝 scripts/build_runtime.ps1 (+1 -1)

📄 Description

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).


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ubiquitarianism/leonida/pull/1598 **Author:** [@aslan2142](https://github.com/aslan2142) **Created:** 11/25/2026 **Status:** ✅ Merged **Merged:** 11/25/2026 **Merged by:** [@aslan2142](https://github.com/aslan2142) **Base:** `main` ← **Head:** `silent-audio-endpoint` --- ### 📝 Commits (2) - [`d4ce33e`](https://github.com/ubiquitarianism/leonida/commit/d4ce33ed42ea69487b47c609d12a2d62db53313f) runtime: serve a silent output endpoint when the host has none - [`018145b`](https://github.com/ubiquitarianism/leonida/commit/018145b3388e739d879ff5a002bafae31e49e232) runtime: serve the spatial stream on the silent output endpoint ### 📊 Changes **8 files changed** (+2163 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `docs/runtime_imports.md` (+39 -0) 📝 `runtime/CMakeLists.txt` (+18 -0) 📝 `runtime/README.md` (+1 -0) 📝 `runtime/shims/com_shim.cpp` (+7 -1) ➕ `runtime/shims/silent_audio.cpp` (+1308 -0) ➕ `runtime/shims/silent_audio.h` (+61 -0) ➕ `runtime/test/silent_audio_test.cpp` (+728 -0) 📝 `scripts/build_runtime.ps1` (+1 -1) </details> ### 📄 Description 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). --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
4ld0 2026-11-26 20:21:52 +01:00
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
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.

Dependencies

No dependencies set

Reference
starred/leonida#1615
No description provided.