Repository navigation
XAudio2: a voice at a reused address drops the stale decoder's state - #456
DavidM1911 wants to merge 2 commits into
Conversation
An IXAudio2 engine released without DestroyVoice on its voices leaves their entries in XMA / DECODED_VOICES (and DECODED_LIVE_COUNT incremented, the DecodedCallback leaked). When Windows hands the same address to a later CreateSourceVoice, the new voice inherited them: a plain PCM voice's SubmitSourceBuffer calls were fed to the stale Opus / XMA decoder. evict_voice() forgets both tables on every successful create, on the decoded and the plain paths; destroy_voice shares the same take/release helpers. Fixes part of xcl-dev#328. Assisted-by: Devin (SWE-2 Flash Medium)
shdann
left a comment
There was a problem hiding this comment.
crates/xcl/src/hle/xaudio2.rs:1843 asserts that the process has zero decoded voices after the test removes its own voice. The Opus and XMA2 lifetime tests in the same binary can each hold a decoded voice at that point. With parallel tests, eviction can succeed and the count can still be one. The preceding two assertions already check removal of this voice by address. Please keep those assertions and check the global count in an isolated test process if counter coverage is needed. Static review of 00f0fd5 with OpenAI Codex (GPT-6).
|
Code audit + NVIDIA RTX 5080 test run on ReviewLooks clean —
Tested
Not tested
AI use: code review and test run orchestrated with Antigravity (Gemini 4 Neon) on the hardware listed above. |
|
Re-ran the regression smoke on the new head
|
|
Independent parallel XAudio2 test check at PR head Tested on Windows 11 Home 26200.9974, Intel Core i5-8400, Rust 1.100.0 x86_64-pc-windows-msvc, debug. Not tested: the prior revision's failure rate, full workspace, retail gameplay, or an actual engine-teardown/address-reuse sequence. The stale-address regression uses synthetic state. AI use: OpenAI Codex (GPT-6) ran the local tests and drafted the report. |
|
Serial-test confirmation on NVIDIA: head
Not tested: a retail voice-reuse scenario end-to-end (no audible check). AI use: GPT-6.2 Astra (API model selector) in DSH ran the tests and wrote this comment; the human contributor reviewed it. |
|
Test report: on this machine this PR is what made the title's sound continuous (the choppy sound from #260). Tested
Not tested
AI use
|
Fixes #328.
An
IXAudio2engine released withoutDestroyVoiceon its voices leaves their entries inXMA/DECODED_VOICES(andDECODED_LIVE_COUNTincremented, theDecodedCallbackleaked). When Windows hands the same address to a laterCreateSourceVoice, the new voice inherited them: a plain PCM voice'sSubmitSourceBuffercalls were fed to the stale Opus/XMA decoder.evict_voice()now forgets both tables on every successful create, on the decoded path (create_decoded_voice) and the plain/silent path, before the new entry is inserted.destroy_voiceshares the same take/release helpers, so teardown is unchanged.What is in it
crates/xcl/src/hle/xaudio2.rs:take_decoded_voice/release_decoded_handle/evict_voicehelpers;evict_voicecalled after*ppon both create paths;destroy_voicerefactored onto the helpers; one unit test that plants staleXMA+DECODED_VOICESentries at a fake voice address and checks both maps and the live count after eviction.Tested
x86_64-pc-windows-msvc, debug build:cargo test -p xcl --lib xaudio2: 10 passed, 0 failed (includes the new test; the real-engine XAudio2 tests also pass)cargo test --workspace -- --test-threads=4: 677 passed, 0 failed, 41 ignoredno wave64recompiler GPU tests (ran on the iGPU in the GPU test results: NVIDIA RTX 3080 (wave32) and AMD RDNA2 iGPU (no mesh shaders) #42 report)scripts/smoke.ps1 -Seconds 60,cargo build --release -p xcl:main
a6f5f7a:this PR's head
00f0fd5(rerun after a first cold-cache pass showed 685 frames; warm-cache numbers below):Not tested
AI use