XMA decoder: lock only voices that are on, sleep while none is #23
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Belobug--VIctory-Belobug-AMD!23
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-23"
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?
@romainhedouin on GitHub · 2026-11-25 12:28 UTC · original
romainhedouin:perf/xma-pump-idle→a-publier· +30 −9 · 1 files · 1 commits · openThe audio decoder thread woke up every 2 ms and locked every voice, including voices that are switched off. Now it skips switched-off voices without locking them, and sleeps until woken while no voice is on. Switching a voice on or giving it data already wakes the thread, so nothing is missed. Decoding of voices that are on is unchanged.
Counts from the code, not timings. Type-checked for Windows (
cargo clippy -p victory-hle --target x86_64-pc-windows-msvc, with and without--all-features, no new warnings); not run.🤖 Generated with Claude Code
@Ekabusto on GitHub · 2026-11-25 12:47 UTC · original
Checked locally: builds.
cargo test -p victory-hle --libshows only the fivexmemfailures that are already onmain(#2 and #8); the XMA tests pass. No conflicts withmainor the other open PRs.The wake-up logic holds:
enableis the only place that makes a voiceSome, and it storesenabled = trueunder the voice's lock beforewake_decoder()unparks the thread. An unpark before thepark()leaves the token set, so a voice enabled during a pass that found none is not missed.disableclears the flag under the same lock, andenabledis rebuilt together withvoicesinAcpHalAllocateShapeContexts. Looks good to me.Reviewed on Windows 11 (build 26300), Rust 1.98.1, each PR in its own worktree; no game data, not run in the game. AI-assisted (Claude Code).
63ebaa237ctoffc0cb40c4@gut0to on GitHub · 2026-11-27 14:47 UTC · original · reviewed
AI-assisted static review (ChatGPT); I inspected the wake path but did not run tests.
@ -711,0 +724,4 @@let active = xma().pump();if active == 0 {// Enabling a voice wakes the thread.std::thread::park();@gut0to on GitHub · 2026-11-27 14:47 UTC · original
Could the idle-worker liveness contract get a deterministic test? The zero-active path now parks indefinitely, so enabling a voice must wake the worker both when it is already parked and when the wake lands after
pump()returns zero but beforepark(). A barrier or test seam around that boundary could verify both interleavings without relying on the former 2 ms timeout.View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.