Repository navigation
Conversation
In `StreamConfig::from_xma2_wfx`, standard `XMA2WAVEFORMATEX` headers (`cbSize == 34`) previously assigned 2 channels to every stream `i` with `(i + 1) * 2 <= channels` whenever `num_streams != channels`. For valid multi-stream layouts mixing stereo and mono streams where `ceil(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]`, or 7.1 5/6-stream), that assigned too many 2-channel streams and rejected the header with a channel-count mismatch (`XCL-BT-015`). Validate `num_streams <= channels <= num_streams * MAX_CHANNELS_PER_STREAM` and assign `stereo = channels - num_streams` 2-channel streams followed by 1-channel streams, subsuming the all-mono special case while keeping packed and invalid stream counts unchanged. Add unit and end-to-end 4-stream 5.1 decode regression tests. Part of xcl-dev#1488 Assisted-by: Google Antigravity (Gemini 4 Neon)
|
Code review on
Remaining before merge: |
PR #2032 verification on STOR-WINLABVerified the live PR head b32eadf from refs/pull/2032/head, with a clean worktree. Fetched main was cbc296a. 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 |
|
Verification on RTX 3060 Ti (Windows 11), branch merged with current
Thanks! |
|
Tested head
Not tested: full suite, GPU, retail title. AI-assisted (Claude Code, Claude Sonnet 5.5 ran the tests; Claude Opus 5.5 checked and posted). |
|
merge-check claim |
|
merge-check |
|
merge-check claim |
|
merge-check |
|
No open or merged PR changes the AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human. |
Fixes
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.