mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 22:40:52 +01:00
[PR #2133] silent_audio: an empty GetBuffer packet leaves nothing pending (SILENT-AUDIO-EMPTY-PACKET) #2137
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#2137
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/2133
Author: @syfyra
Created: 11/25/2026
Status: 🔄 Open
Base:
main← Head:fix/silent-audio-zero-frame-getbuffer📝 Commits (1)
6993f7asilent_audio: an empty GetBuffer packet leaves nothing pending (SILENT-AUDIO-EMPTY-PACKET)📊 Changes
2 files changed (+11 additions, -0 deletions)
View changed files
📝
runtime/shims/silent_audio.cpp(+5 -0)📝
runtime/test/silent_audio_test.cpp(+6 -0)📄 Description
Claimed in the coordination issue as: SILENT-AUDIO-EMPTY-PACKET (claim comment to follow)
What and why
runtime/shims/silent_audio.cppAudioClient::get_buffersetpending_for every successfulIAudioRenderClient::GetBuffer, includingGetBuffer(0). The GetBuffer remarks say the client must call ReleaseBuffer after a packet of any size other than 0, and may or may not release a packet of size 0.A render loop that asks for its free space whatever it is and releases only what it filled does exactly that. The first event after priming the buffer before
Start(the usual pattern, and whatStartsignals right away) finds the buffer full, so it gets an empty packet and moves on. From then on everyGetBufferreturnedAUDCLNT_E_OUT_OF_ORDERandResetreturnedAUDCLNT_E_BUFFER_OPERATION_PENDING: the stream never took audio again. AReleaseBuffer(5)after the empty packet returnedAUDCLNT_E_INVALID_SIZEinstead ofAUDCLNT_E_OUT_OF_ORDER.An empty packet now returns
S_OKwithout marking anything pending. Measured with a small probe against Windows 11's audio engine (default render endpoint, shared mode, 100 ms buffer):GetBuffer(0)S_OK, null pointerReset(), no releaseS_OKAUDCLNT_E_BUFFER_OPERATION_PENDINGGetBuffer(10), no releaseS_OKAUDCLNT_E_OUT_OF_ORDERS_OKGetBuffer(0), thenReleaseBuffer(5)AUDCLNT_E_OUT_OF_ORDERAUDCLNT_E_INVALID_SIZEAUDCLNT_E_OUT_OF_ORDERGetBuffer(0)while 10 frames are heldAUDCLNT_E_OUT_OF_ORDERThe measured title activates
ISpatialAudioClientfirst (docs/runtime_imports.md), so this is theIAudioClientpath's contract, for any caller that takes it.Tested
Windows 11, MSVC 14.44 (Build Tools), RelWithDebInfo:
silent_audio_testgets four checks before the stream is primed:GetBuffer(0)gets an empty packet,ReleaseBuffer(5)after it is out of order,Resetsucceeds, and a second empty packet left unreleased does not block the priming that follows. Onmainthose and 10 later checks fail (the empty packet stays pending and the priming, the run andResetall fail); with the fix all 133 checks pass.scripts/check_no_game_data.pyon both files.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.