Skip to content

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

Open
UwUCammie wants to merge 1 commit into
ProjectLeonida:mainfrom
UwUCammie:uwu/no-audio-endpoint-warning
Open

UwUCammie wants to merge 1 commit into
ProjectLeonida:mainfrom
UwUCammie:uwu/no-audio-endpoint-warning

Conversation

@UwUCammie

@UwUCammie UwUCammie commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

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

…NO-AUDIO-ENDPOINT-DEADLOCK)

With no default audio render endpoint the retail title skips its audio
device setup and later stops on a loading screen after the first-run
screens: its per-frame audio update returns early while holding a lock,
the frame thread waits on that lock for good, the frame counter stops and
the main thread waits for frames that never come. Nothing crashes, so the
cause is hard to find from the logs.

The runtime now asks the host once at start (on its own thread and COM
apartment) and prints an [rt] audio line when there is no default render
endpoint. docs/boot.md gets the measured chain and the silent ALSA null
device that a muted Wine run can use instead.

@abnalstlll-byte abnalstlll-byte left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed and verified. Critical usability enhancement resolving the loading screen stall caused by the game's audio thread acquiring a lock and returning early without releasing it when no audio render endpoint is present. Probing via IMMDeviceEnumerator::GetDefaultAudioEndpoint on an isolated COM thread at startup cleanly warns the user without corrupting main thread COM state. Documentation and ALSA null workaround in docs/boot.md are excellent. 100% clean-room compliant.

@Deedlyy

Deedlyy commented Nov 24, 2026

Copy link
Copy Markdown

Recommendation: [WAIT]

Reasoning: Adds a startup probe (own thread and COM apartment) that warns when the host has no default audio render endpoint, plus a well-written docs/boot.md section explaining the measured deadlock and an ALSA null-plugin workaround. The idea is useful, but the probe runs on every start and has no test or independent run. Before merging, someone should confirm on Windows and Wine that it doesn't delay or block startup when an endpoint exists and that it warns correctly when none does. CI (label, change-scope, no-game-data and the Runtime jobs) is still queued awaiting maintainer workflow approval, so nothing has run in CI yet; GitHub reports no merge conflict with main.

Impact level: 3/10

@UwUCammie

Copy link
Copy Markdown
Contributor Author

Note

🤖 Claude Opus 5.5 responding on behalf of UwUCammie

Measured both cases under Wine 11.22 (RX 7900 XT, same build as the PR plus a temporary timing print around the probe; not committed):

Host Probe time Result Warning
ALSA null device (endpoint present) 8 ms, 10 ms GetDefaultAudioEndpoint S_OK none
winealsa/winepulse disabled, no /dev/snd (no endpoint) 12 ms, 19 ms 0x80070490 (E_NOTFOUND) printed once

The probe also has a 5 s ceiling: if the audio service never answers, the result is unknown and nothing is printed, so it cannot block startup. Not yet run on Windows; that confirmation still needs someone with a Windows host.

@github-actions github-actions Bot added the needs rebase Conflicts with the base branch: rebase it on main label Nov 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs rebase Conflicts with the base branch: rebase it on main

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants