XAudio2: compute mixed stereo and mono XMA2WAVEFORMATEX stream layouts #2032
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!2032
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2032"
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?
@Decodere on GitHub · 2026-11-25 01:20 UTC · original
Decodere:fix-1488-xma2-stream-layout→main· +85 −15 · 1 files · 1 commits · openFixes
StreamConfig::from_xma2_wfxincrates/xcl/src/hle/xma2/mod.rsso standardXMA2WAVEFORMATEXheaders (cbSize == 34) accept valid mixed stereo + mono multi-stream layouts whereceil(channels / 2) < num_streams < channels(such as 5.1 4-stream[2, 2, 1, 1], 4.0 3-stream[2, 1, 1], 5.0 4-stream[2, 1, 1, 1], and 7.1 5/6-stream). Part of #1488 (XCL-BT-015).Previously, whenever
num_streams != channels,from_xma2_wfxassigned 2 channels to every streamiwith(i + 1) * 2 <= channelsand 1 otherwise. For valid mixed stereo/mono layouts like(channels = 6, num_streams = 4), that assigned[2, 2, 2, 1](sum 7 != 6) and rejected the header withXMA2 stream count 4 does not match 6 channels. Because each XMA2 stream holds 1 or 2 channels, any feasible(channels, num_streams)pair withnum_streams <= channels <= num_streams * MAX_CHANNELS_PER_STREAMuniquely hasstereo = channels - num_streams2-channel streams andnum_streams - stereo1-channel streams.What is in it
crates/xcl/src/hle/xma2/mod.rs:StreamConfig::from_xma2_wfx(extradata.len() == 34), validatech < num_streams || ch > num_streams * MAX_CHANNELS_PER_STREAMand assignstereo = ch - num_streams2-channel streams followed by 1-channel streams (subsuming thenum_streams == channelsspecial case while preserving packed,NumStreams == 0default, and invalid stream-count behavior).stream_config_xma2_wfx_assigns_mixed_stereo_and_mono_streamscovering valid mixed stereo/mono layouts,Decoder::newconstruction, invalid stream counts, and an end-to-end 4-stream 5.1 ([2, 2, 1, 1]) interleaved decode verified against standalone stereo and mono reference decodes.Tested
0ef1bc386), DXC 1.9.2609.5 (01b62ad4), release build.hle::xma2::tests::stream_config_xma2_wfx_assigns_mixed_stereo_and_mono_streamsfails without the fix (channels=4 streams=3: XMA2 stream count 3 does not match 4 channels).cargo test --release -p xcl --lib hle::xma2::tests -- --nocapture: 8 passed, 0 failed, 0 ignored.cargo test --release -p xcl --lib hle::xaudio2 -- --nocapture: 9 passed, 0 failed, 0 ignored.cargo build --release --workspace+cargo test --release --workspace -- --test-threads=4: 1063 passed, 0 failed, 45 ignored across 20 test binaries.SKIPPEDGPU/runtime tests on this adapter (24 lines):no wave64subcases acrossgpu::recomp::lower::tests(4),gpu::recomp::lower_dxil::tests(13), andgpu::recomp::tests(2)#1426refusals (V_MUL_F16,V_PK_MUL_F16,V_CVT_F16_F32) ingpu::recomp::lower_dxil::testsshaders::tests::pso_measurement_compiles_an_exact_synthetic_record: cannot disable the driver cache (Windows Developer Mode is required)heap_window_out_of_memory_falls_back_to_the_switch_form: no heap windowsRegression run
scripts/smoke.ps1onmain(656c0e8ca070bdc9d7cb197d264792ef49304865) and on this PR's head commit (b32eadfea2c6897bc41b2e4a90ae58c30e25ba56):Not tested
XMA2WAVEFORMATEXheaders beyond the synthetic 4-stream 5.1 bitstream decode test.XMA2WAVEFORMATEXcannot encode because it carries onlyNumStreamsand no per-streamXMA2STREAMFORMATtable.--release).AI use
StreamConfig::from_xma2_wfx, implemented the layout calculation fix, unit and 4-stream 5.1 decode regression tests, and PR description; all tests and paired 60s smoke runs were executed and verified locally on RTX 4060 hardware.@raylitebull on GitHub · 2026-11-25 01:25 UTC · original
Code review on
b32eadf:StreamConfig::from_xma2_wfxincrates/xcl/src/hle/xma2/mod.rscleanly validatesch < num_streams || ch > num_streams * MAX_CHANNELS_PER_STREAMand partitionsstereo = ch - num_streams(2 channels) followed by mono streams (1 channel), supporting mixed stereo + monoXMA2WAVEFORMATEXlayouts (cbSize == 34) such as[2, 2, 1, 1].stream_config_xma2_wfx_assigns_mixed_stereo_and_mono_streamsthoroughly covers valid packed, mixed, all-mono, and invalid channel/stream combinations plus an end-to-end 5.1 4-stream decode against stereo/mono reference packets.PR descriptionis green andBuild and test (Windows, no GPU)is currently running.Remaining before merge:
Build and testfinishing green plus dual-vendor (AMD + NVIDIA) / independent test verification onb32eadf.@JJAutoCompare on GitHub · 2026-11-25 02:25 UTC · original
PR #2032 verification on STOR-WINLAB
Verified the live PR head
b32eadfea2from refs/pull/2032/head, with a clean worktree. Fetched main wascbc296ab65. git merge-tree --write-tree origin/main HEAD exited 0 and produced tree 24580937c02cc9b28262b7f89fcada21c50ccbab.What is in it
Tested
Not tested
AI use
Coordinator #2 (T3 Code / Antigravity, gemini-4-neon) verified the counts against
pr2032-suite.logand published this report.@DavidM1911 on GitHub · 2026-11-25 04:28 UTC · original
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.)Thanks!
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.