XAudio2: keep XMA2 skip_packets == 0xFF EOF sentinel from decrementing #1571
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1581"
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?
Imported from ivall/xcl. Originally posted by b3IKK on 2026-11-24T17:54:49Z.
Addresses
XCL-BT-016from #1488.In XMA2 packet headers,
PacketSkipCount == 0xFF(255) is the end-of-stream sentinel meaning no further packets belong to that stream.Decoder::advance_streamdecremented every stream'sskip_packetsunconditionally (s.skip_packets.saturating_sub(1)), so after 255 packets of sibling streams in a multi-stream XMA2 track, a finished stream's counter reached0and stole subsequent packets belonging to still-active streams.This skips decrementing
s.skip_packetswhen it equals0xFF.What is in it
crates/xcl/src/hle/xma2/mod.rs: preserveskip_packets == 0xFFinDecoder::advance_stream; add unit testeof_skip_packets_sentinel_255_is_never_decremented(verified failing before the fix with254 != 255).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): 777 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; 1no heap windows—heap_window_out_of_memory_falls_back_to_the_switch_form)cargo test -p xcl --lib xma2: 10 passed, 0 failed (eof_skip_packets_sentinel_255_is_never_decrementedfailed before the fix)Regression run
main:
PR:
Not tested
AI use
XCL-BT-016from #1488, wrote the fix and unit test, ran the test suite andscripts/smoke.ps1regression runs, and drafted this PR description.Imported from ivall/xcl. Originally posted by futurepro62 on 2026-11-24T18:53:04Z.
Full-suite run, since this PR has no test report yet. Tested exact head
da1b46c(on its base9e3831e).Tested
cargo build --workspace, thenXCL_REQUIRE_GPU=mesh cargo test --workspace -- --test-threads=4 --skip heap_window_out_of_memory_falls_back_to_the_switch_form: 776 passed, 0 failed, 41 ignored. SKIPPED (no wave64):gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware.eof_skip_packets_sentinel_255_is_never_decremented.XCL_ADAPTER=radeon),cargo test --workspace -- --test-threads=4: 777 passed, 0 failed, 41 ignored. SKIPPED:heap_window_out_of_memory_falls_back_to_the_switch_form(no heap windows).heap_window_out_of_memory_falls_back_to_the_switch_formwas skipped with--skip. It fails on main9e3831etoo, not because of this PR: underXCL_REQUIRE_GPU=mesh,runner::skip_testturns every skip except "no wave64" into a failure, including this test's opt-in "no heap windows" skip (XCL_HEAP_WINDOWSunset). Reported as #1651.Not tested
AI use
Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-24T20:02:49Z.
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, ~22 ignored. (Intermittent single-test flake under parallel scheduling; clean on single-threaded rerun — same flake seen on unmodifiedmain.)Thanks!
Imported from ivall/xcl. Originally posted by JJAutoCompare on 2026-11-25T05:14:57Z.
Empirical test report (
da1b46c2)Hardware / environment
da1b46c255816e4f2057ba5b5aee4409e930921d.rustc --versionreturnedrustc 1.100.0 (0ef1bc386 2026-11-09).--versionreturneddxcompiler.dll: 1.9(5512-01b62ad4)(1.9.2609.5) - 1.9.2609.5 (01b62ad47).Commands and results
cargo test --workspace --no-runcompleted with exit code 0 and compiled the workspace test executables. Test counts are inapplicable to this compile-only command.Both commands ran directly, outside
Invoke-ArcTest.ps1, with zero Arc GPU mutex hold. The focused counts came from the test summary and the case-sensitiveSKIPPEDmarker in the captured output.Observed behavior
The XMA2 regression test passed. Across 300 stream advances, the finished stream kept its
0xFFend-of-stream sentinel and the active stream stayed selected. The active stream also stayed selected when its own skip counter was set to1. The test uses an in-memory decoder and requires no audio endpoint. There were no audio endpoint skips.Not tested
Coverage was limited to workspace test compilation and the PR's focused CPU regression test. The full GPU workspace suite and game smoke runs were omitted.
AI use
Verified with T3 Code / Codex (gpt-6.2-sol, reasoningEffort: high). Coordinator #2 (T3 Code / Antigravity, gemini-4-neon) verified counts against
pr1581-focused.logand published.Imported from ivall/xcl. Originally posted by upipibi on 2026-11-26T21:57:48Z.
Tested head
da1b46c255816e4f2057ba5b5aee4409e930921d, merge-base9e3831e1f570d3646e53ab753b19ec07eb8f1485, Windows 11, rustc 1.100.0 MSVC, debug, CPU only (1 run per side).cargo test -p xcl --lib hle::xma2 -- --test-threads=1: head 8 passed, 0 failed; merge-base 7 passed, 0 failed (new test absent there).Negative control: with only the PR's test hunk added to the merge-base,
eof_skip_packets_sentinel_255_is_never_decrementedfails (0xFF EOF sentinel must never decrement, left 254, right 255): 0 passed, 1 failed.Not tested: GPU, retail title. AI-assisted (Claude Code, Claude Sonnet 5.5 ran the tests; Claude Opus 5.5 checked and posted).
Imported from ivall/xcl. Originally posted by SlopTart on 2026-11-26T22:15:56Z.
Linux (Wine) dual-lane run against your fix merged onto current main - clean, your sentinel test green on both vendor stacks.
Heads-up first: your head
da1b46c2is 635 commits behind main (branched from9e3831e1), so we did what the other verifiers here do and merged your one file onto current main8b957bec(auto-merge clean; diff vs main is exactly your 29-linexma2/mod.rschange), then ran the full suite:xma2::tests::eof_skip_packets_sentinel_255_is_never_decremented(yours): ok on both lanes. Nothing else moved in either red set.One clarification for anyone skimming XMA2 threads: the standing red
xaudio2::tests::xma2_source_voice_decodes_and_manages_lifetimethat appears in every one of our runs is not your bug and not fixed by this PR - we root-caused it in #2481 (the bundled FAudio returnspCurrentBufferContext = NULLfor stopped voices with queued buffers; environment-side, not xcl's decoder). Your fix is in xcl's own XMA2 decoder, a different layer entirely; failure signature unchanged by it (left: 0, right: 12291, identical on both lanes).Suite:
cargo test --release --locked -p xcl --lib --target x86_64-pc-windows-gnu -- --test-threads=2 --skip gpu::, compared against same-day main baselines on the same machines (rig 606/2, boxb 605/3).AI use: Hermes agent (local Qwen-class) ran the tests and drafted this; I checked it before posting.
Imported from ivall/xcl. Originally posted by github-actions[bot] on 2026-12-01T02:35:58Z.
Nothing has happened on this PR for 3 days, so it is marked
staleand will be closed in 4 days. A push or a comment takes the mark off: rebase it ontomainif it conflicts, and say in one line what it still fixes. If it only waits for a maintainer, a comment saying so is enough.Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T06:11:10Z.
Triage (#1607) – head
da1b46cNo open or merged PR makes the same change. xma2/mod.rs advance_stream: the test fails without the fix (the 0xFF count would be decremented on the first advance).
The diff gives no source for 0xFF being an end-of-stream value of the XMA2 packet skip field; FFmpeg's xma decoder, which this decoder follows, decrements every stream's count with no such case. Please cite where the sentinel is defined.
Recommendation: keep open.
AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
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.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.