XAudio2: reset XMA2 bit reservoir and skip orphan continuations after packet loss #1460
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl!1460
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1460"
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?
@b3IKK on GitHub · 2026-11-24 16:27 UTC · original
b3IKK:xma2/reservoir-reset-on-packet-loss→main· +57 −4 · 1 files · 1 commits · openIn
xma2::StreamDecoder::decode_packet_step, whenpacket_losswas set (at stream start, afterflush(), or after a decode error) and a continuation packet arrived withnum_bits_prev_frame > 0:save_bits(..., append = true)unconditionally wrote up to 16,352 discarded bits intoself.reservoirand advancedreservoir.bit_pos.if self.packet_losszeroednum_saved_bitsand clearedpacket_losswithout callingreservoir.reset().num_bits_prev_frame,save_bitsappended at the stalereservoir.bit_poswhiledecode_frameread bits0..num_saved_bitsfrom the previous packet's discarded bytes, decoding a phantom frame and corrupting overlap-add state.This only appends/decodes
num_bits_prev_framewhen!self.packet_loss && self.num_saved_bits > 0(otherwise skipping those bits withpgb.skip_bits), and resetsself.reservoirandself.num_saved_bitswheneverdecode_frameconsumes the reservoir orpacket_lossis cleared.What is in it
crates/xcl/src/hle/xma2/mod.rs: skip orphan continuation bits when there is no valid saved prefix; resetreservoirandnum_saved_bitson frame consumption and packet-loss recovery; add unit testpacket_loss_continuation_does_not_desync_reservoir_or_decode_phantom_frame(verified failing before the fix withreservoir.bit_pos == 16352).Tested
stable-x86_64-pc-windows-msvc), DXC 1.9.2609.5, debug (scripts/test.ps1) and release (scripts/smoke.ps1).\scripts\test.ps1(cargo build --workspace+cargo test --workspace -- --test-threads=4): 771 passed, 0 failed, 41 ignored (SKIPPED GPU tests: 2no wave64—gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask,gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware)cargo test -p xcl --lib xma2: 10 passed, 0 failed (packet_loss_continuation_does_not_desync_reservoir_or_decode_phantom_framefailed before the fix)Regression run
main:
PR:
Not tested
AI use
hle/xma2/mod.rs, wrote the fix and unit test, ran the test suite andscripts/smoke.ps1regression runs, and drafted this PR description.@futurepro62 on GitHub · 2026-11-24 16:55 UTC · original · edited 2026-11-24 17:04 UTC
Full-suite run, since this PR has no test report yet. Tested exact head
0817568(on its baseb7aa9f3).Tested
cargo build --workspace, thenXCL_REQUIRE_GPU=mesh cargo test --workspace -- --test-threads=4: 771 passed, 0 failed, 41 ignored. SKIPPED (no wave64):gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware.packet_loss_continuation_does_not_desync_reservoir_or_decode_phantom_frame.XCL_ADAPTER=radeon),cargo test --workspace -- --test-threads=4: 771 passed, 0 failed, 41 ignored, no skips.Not tested
AI use
@DavidM1911 on GitHub · 2026-11-24 18:52 UTC · original
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, ~21 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling; clean on single-threaded rerun — same flake seen on unmodifiedmain.)Thanks!
@S1m0ne1997 on GitHub · 2026-11-25 15:16 UTC · original
Test report for
08175680d04a8b5fec8066bace3e3c43602d915f(this PR's head), for #1607.Tested
rustc 1.100.0 (0ef1bc386 2026-11-09)x86_64-pc-windows-msvc, debug.cargo build --workspace, thencargo test --workspace -- --test-threads=4at the head: 771 passed, 0 failed, 41 ignored.gpu_geometry_wave32_prefix_count_over_a_mask(no wave64),gpu_wave32_program_in_wave64_hardware(no wave64).Regression run (retail title,
scripts/smoke.ps1 -Seconds 60, release;mainbuilt from the commit in its block, this PR from its head with no changes tocrates/, both run with thescripts/smoke.ps1ofmain, which hashes the name of the game folder)main:
this PR:
Not tested
AI use: Claude Code with Claude Opus 5.5 ran the build, the suite and the regression run and wrote this report at my request.
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.