mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 21:30:53 +01:00
[PR #2387] silent_audio: the silent endpoint answers four argument checks as Windows does (SILENT-AUDIO-HOST-ANSWERS) #2390
Labels
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
starred/leonida#2390
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/ubiquitarianism/leonida/pull/2387
Author: @syfyra
Created: 11/26/2026
Status: 🔄 Open
Base:
main← Head:fix/silent-audio-host-answers📝 Commits (1)
d38ef53silent_audio: the silent endpoint answers four argument checks as Windows does (SILENT-AUDIO-HOST-ANSWERS)📊 Changes
2 files changed (+72 additions, -5 deletions)
View changed files
📝
runtime/shims/silent_audio.cpp(+25 -5)📝
runtime/test/silent_audio_test.cpp(+47 -0)📄 Description
Claimed in the coordination issue as: SILENT-AUDIO-HOST-ANSWERS
What and why
I ran the same
IAudioClient/IAudioRenderClientcalls against the host's default render endpoint and against the silent endpoint (LEONIDA_AUDIO=silent), side by side in one probe built withsilent_audio.cpp, on Windows 11, with a fresh client for each case. Most answers already match. Four calls answer differently:mainInitialize/IsFormatSupportedwith a malformedWAVEFORMATEX:nChannels,nSamplesPerSecorwBitsPerSample0,nBlockAlignornAvgBytesPerSecnot following from them,WAVE_FORMAT_EXTENSIBLEwithcbSize< 22E_INVALIDARGAUDCLNT_E_UNSUPPORTED_FORMAT; a wrongnAvgBytesPerSecwas taken as a valid formatInitializewith a malformed format on a client that is already initializedAUDCLNT_E_ALREADY_INITIALIZEDAUDCLNT_E_UNSUPPORTED_FORMAT(the format was checked first)GetService(IAudioCaptureClient)on the render clientAUDCLNT_E_WRONG_ENDPOINT_TYPEE_NOINTERFACEResetwhen there is nothing to reset (never started, or reset already)S_OKS_FALSEIAudioRenderClient::ReleaseBuffer(n, flags),n> 0, with any flag butAUDCLNT_BUFFERFLAGS_SILENTand bit 31 (one bit at a time over all 32)E_INVALIDARG, checked before the size, and the packet stays pendingEach is now answered as the host does. The order of the checks follows the host too:
closestis stillE_POINTERfirst;ReleaseBufferwith nothing pending is stillAUDCLNT_E_OUT_OF_ORDERbefore the flags are read;ReleaseBufferdoes not look at the flags (the host returnsS_OKthere).Not changed, because the answers depend on the device and engine rather than on the call: which well-formed formats are supported (the shim takes any PCM or float format on purpose), the
Initializestream-flag checks (the host's answers per bit are irregular), and the host's ownInitializerefusal of 12-bit or 64-channel formats.Tested
Windows 11, MSVC 14.44 (Build Tools), RelWithDebInfo:
silent_audio_testgets five checks, matching the table:IsFormatSupportedandInitializeare bothE_INVALIDARG, and nothing comes back inclosest;AUDCLNT_E_ALREADY_INITIALIZED;GetService(IAudioCaptureClient)isAUDCLNT_E_WRONG_ENDPOINT_TYPE;Resets of an unused stream areS_OK;ReleaseBufferwithDATA_DISCONTINUITY,0x10, and0x4with an oversized count isE_INVALIDARG, and the packet is still released afterwards.On
main, 5 checks fail, plus one follow-on: main released the packet on the bad flag, so the later release of it fails. With this branch, 134 of 134 pass.Merged together with #2133 and #2134, which also change this file and test: 139 of 139 pass. Both merge cleanly with it (
scripts/pr_overlap.pyfrom #2349).scripts/check_no_game_data.pyon both files.Not tested under Wine.
GPUs tested: n/a (CPU tests)
AI-assisted: yes (Claude Code, Claude Opus 5.5)
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed. (n/a: no translator change)🤖 Generated with Claude Code
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.