[PR #1109] runtime: warn at start when the host has no default audio output (RT-NO-AUDIO-ENDPOINT-DEADLOCK) #1144

Open
opened 2026-11-26 20:20:14 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/1109
Author: @UwUCammie
Created: 11/24/2026
Status: 🔄 Open

Base: main ← Head: uwu/no-audio-endpoint-warning


📝 Commits (1)

  • 40ab6cb runtime: warn at start when the host has no default audio output (RT-NO-AUDIO-ENDPOINT-DEADLOCK)

📊 Changes

4 files changed (+119 additions, -2 deletions)

View changed files

📝 docs/README.md (+1 -1)
📝 docs/boot.md (+40 -1)
➕ runtime/src/audio_endpoint_probe.h (+70 -0)
📝 runtime/src/main.cpp (+8 -0)

📄 Description

Item: RT-NO-AUDIO-ENDPOINT-DEADLOCK (claimed in #14)

What

With no default audio render endpoint, the retail title does not fail at once. It stops after the first-run screens (account, privacy and terms) on a dark loading screen that keeps being drawn. Nothing crashes, and nothing in the startup or D3D12 trace points at audio. A muted Wine run is the usual way to get there: winealsa.drv and winepulse.drv off, or no /dev/snd and no sound server sockets.

This PR does two things:

  • Startup warning. runtime/src/audio_endpoint_probe.h asks the host once at start, on its own thread and in its own COM apartment, for IMMDeviceEnumerator::GetDefaultAudioEndpoint(eRender, eConsole). When there is none, main.cpp prints an [rt] audio: line that points at the docs.
  • Docs. docs/boot.md §6 records the measured chain and a silent workaround for muted runs: ALSA's null plugin through ALSA_CONFIG_PATH.

The measured chain

Measured on my own copy of the Xbox package 1.0.2.1, using breakpoint hit counts and thread dumps (LEONIDA_BREAK, LEONIDA_THREAD_DUMP):

  1. The title asks for the default render endpoint once. When there is none, it skips its audio device setup, which activates IAudioClient and ISpatialAudioClient. The audio object's output list stays empty.
  2. The per-frame audio update takes that object's lock, finds no outputs, and returns early without releasing the lock. It runs on a pool worker, which then goes back to waiting for jobs while still owning the lock.
  3. The frame thread blocks on the same lock. The frame tick, which advances the frame counter and wakes threads parked on it, ran exactly once in the whole run.
  4. The main thread parks in a startup step until the frame counter moves on, so it is never woken. Every streaming update it drives stops too. A later synchronous streaming request then spins for ever.

With an output device, the same build gets past this point. The audio setup runs, the early return is never taken, and the frame tick keeps running.

The RVAs are in the docs. No game data, code bytes or disassembly are in the PR.

Tested

  • Built gta6rt with clang-cl and xwin on Linux (CachyOS).
    • On current main the link needs synchronization.lib (WaitOnAddress), which #877 adds. I added it only locally to build, and it is not part of this PR.
  • Ran it under Wine 11.22 on an RX 7900 XT (RADV, Mesa 26.3.1):
    • Muted (no output device): the warning is printed with GetDefaultAudioEndpoint returning 0x80070490.
    • ALSA null device from the docs: no warning, and startup is otherwise identical.
  • On my integration branch, with the null device, the boot gets past the loading-screen stall to a later, unrelated stop.
  • python -I scripts/check_no_game_data.py on the changed files passes, and so does tests/test_text_write_line_endings.py.

AI-assisted: yes. The investigation, the code and the docs were written by an AI coding assistant working on this account; the tests above are the ones it ran.


🔄 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/1109 **Author:** [@UwUCammie](https://github.com/UwUCammie) **Created:** 11/24/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `uwu/no-audio-endpoint-warning` --- ### 📝 Commits (1) - [`40ab6cb`](https://github.com/ubiquitarianism/leonida/commit/40ab6cb351e9e3518c351247d2a0bea184ae9f8b) runtime: warn at start when the host has no default audio output (RT-NO-AUDIO-ENDPOINT-DEADLOCK) ### 📊 Changes **4 files changed** (+119 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `docs/README.md` (+1 -1) 📝 `docs/boot.md` (+40 -1) ➕ `runtime/src/audio_endpoint_probe.h` (+70 -0) 📝 `runtime/src/main.cpp` (+8 -0) </details> ### 📄 Description Item: RT-NO-AUDIO-ENDPOINT-DEADLOCK (claimed in #14) ## What With no default audio render endpoint, the retail title does not fail at once. It stops after the first-run screens (account, privacy and terms) on a dark loading screen that keeps being drawn. Nothing crashes, and nothing in the startup or D3D12 trace points at audio. A muted Wine run is the usual way to get there: `winealsa.drv` and `winepulse.drv` off, or no `/dev/snd` and no sound server sockets. This PR does two things: - **Startup warning.** `runtime/src/audio_endpoint_probe.h` asks the host once at start, on its own thread and in its own COM apartment, for `IMMDeviceEnumerator::GetDefaultAudioEndpoint(eRender, eConsole)`. When there is none, `main.cpp` prints an `[rt] audio:` line that points at the docs. - **Docs.** `docs/boot.md` §6 records the measured chain and a silent workaround for muted runs: ALSA's `null` plugin through `ALSA_CONFIG_PATH`. ## The measured chain Measured on my own copy of the Xbox package 1.0.2.1, using breakpoint hit counts and thread dumps (`LEONIDA_BREAK`, `LEONIDA_THREAD_DUMP`): 1. The title asks for the default render endpoint once. When there is none, it skips its audio device setup, which activates `IAudioClient` and `ISpatialAudioClient`. The audio object's output list stays empty. 2. The per-frame audio update takes that object's lock, finds no outputs, and returns early without releasing the lock. It runs on a pool worker, which then goes back to waiting for jobs while still owning the lock. 3. The frame thread blocks on the same lock. The frame tick, which advances the frame counter and wakes threads parked on it, ran exactly once in the whole run. 4. The main thread parks in a startup step until the frame counter moves on, so it is never woken. Every streaming update it drives stops too. A later synchronous streaming request then spins for ever. With an output device, the same build gets past this point. The audio setup runs, the early return is never taken, and the frame tick keeps running. The RVAs are in the docs. No game data, code bytes or disassembly are in the PR. ## Tested - Built `gta6rt` with clang-cl and xwin on Linux (CachyOS). - On current `main` the link needs `synchronization.lib` (`WaitOnAddress`), which #877 adds. I added it only locally to build, and it is not part of this PR. - Ran it under Wine 11.22 on an RX 7900 XT (RADV, Mesa 26.3.1): - **Muted** (no output device): the warning is printed with `GetDefaultAudioEndpoint` returning `0x80070490`. - **ALSA null device** from the docs: no warning, and startup is otherwise identical. - On my integration branch, with the null device, the boot gets past the loading-screen stall to a later, unrelated stop. - `python -I scripts/check_no_game_data.py` on the changed files passes, and so does `tests/test_text_write_line_endings.py`. AI-assisted: yes. The investigation, the code and the docs were written by an AI coding assistant working on this account; the tests above are the ones it ran. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
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#1144
No description provided.