XAudio2: reject invalid XMA stream channel counts #1436

Merged
hajduzsolt merged 1 commit from upstream-pr/1446 into main 2026-12-02 17:38:14 +00:00
hajduzsolt commented 2026-11-24 16:09:26 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by hajduzsolt on 2026-11-24T16:09:26Z.


What is in it

  • The public XMA decoder constructor checks the total channel count but accepts individual streams with zero or more than two channels. Its per-stream decode buffers are sized for one or two channels. Reject invalid stream layouts before constructing decoder state. What is in it - crates/xcl/src/hle/xma2/mod.rs: validate each stream channel count and test invalid and valid synthetic configurations. Tested - Windows 11 Pro x64 build 26300, AMD Ryzen 7 9800X3D, AMD Radeon RX 9070 XT 16 GB, driver 32.0.32029.2010; Rust 1.98.1 MSVC, debug. - cargo test -p xcl --lib decoder_rejects_invalid_per_stream_channel_counts: fails without the guard and passes with it (1 passed, 0 failed). - cargo test --workspace -- --test-threads=4 --nocapture: 771 passed, 0 failed, 41 ignored. The reported passes include tests that return early. - SKIPPED: test_title_draws_with_a_root_signature_under_the_debug_layer and uploads_start_from_each_subresources_state (D3D12 debug layer unavailable). Regression run - [ ] Retail smoke runs pending human verification. main: not run PR: not run Not tested - Retail title and D3D12 debug-layer validation. Parsed XMA headers already validate their individual stream counts; this covers direct constructor configurations. AI use - Codex (GPT-6): wrote implementation and unit tests, ran validation, and drafted this description.

Tested

  • Windows 11 Pro x64, AMD Ryzen 7 9800X3D, AMD Radeon RX 9070 XT 16 GB, Rust MSVC: cargo test --workspace -- --test-threads=4 passed.

Regression run

main:

xcl-smoke v1
commit: b7aa9f3bd212088e0d927439284dc5ed325ce3c7
gpu: AMD Radeon RX 9070 XT
title: A newer retail game
seconds: 60
exit: 0x0
frames shown: 1675 (PresentX 1675)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14837 MB

PR:

xcl-smoke v1
commit: a7f5d8be9b4d131f801ca3716d9843363f4df875
gpu: AMD Radeon RX 9070 XT
title: A newer retail game
seconds: 60
exit: 0x0
frames shown: 1681 (PresentX 1681)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14833 MB

Not tested

  • In-game world gameplay beyond the 60-second startup/menu smoke run (XCL_NETWORK=0) and NVIDIA / wave32-only GPUs.

AI use

  • AI-assisted implementation and synthetic unit tests; human diff review and RX 9070 XT smoke verification completed.
<!-- greyfinch-sync:ivall/xcl:issue:5475863980 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1446). Originally posted by [hajduzsolt](https://github.com/hajduzsolt) on 2026-11-24T16:09:26Z. --- **What is in it** - The public XMA decoder constructor checks the total channel count but accepts individual streams with zero or more than two channels. Its per-stream decode buffers are sized for one or two channels. Reject invalid stream layouts before constructing decoder state. **What is in it** - `crates/xcl/src/hle/xma2/mod.rs`: validate each stream channel count and test invalid and valid synthetic configurations. **Tested** - Windows 11 Pro x64 build 26300, AMD Ryzen 7 9800X3D, AMD Radeon RX 9070 XT 16 GB, driver 32.0.32029.2010; Rust 1.98.1 MSVC, debug. - `cargo test -p xcl --lib decoder_rejects_invalid_per_stream_channel_counts`: fails without the guard and passes with it (1 passed, 0 failed). - `cargo test --workspace -- --test-threads=4 --nocapture`: 771 passed, 0 failed, 41 ignored. The reported passes include tests that return early. - SKIPPED: `test_title_draws_with_a_root_signature_under_the_debug_layer` and `uploads_start_from_each_subresources_state` (D3D12 debug layer unavailable). **Regression run** - [ ] Retail smoke runs pending human verification. main: not run PR: not run **Not tested** - Retail title and D3D12 debug-layer validation. Parsed XMA headers already validate their individual stream counts; this covers direct constructor configurations. **AI use** - Codex (GPT-6): wrote implementation and unit tests, ran validation, and drafted this description. **Tested** - Windows 11 Pro x64, AMD Ryzen 7 9800X3D, AMD Radeon RX 9070 XT 16 GB, Rust MSVC: `cargo test --workspace -- --test-threads=4` passed. **Regression run** main: ``` xcl-smoke v1 commit: b7aa9f3bd212088e0d927439284dc5ed325ce3c7 gpu: AMD Radeon RX 9070 XT title: A newer retail game seconds: 60 exit: 0x0 frames shown: 1675 (PresentX 1675) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14837 MB ``` PR: ``` xcl-smoke v1 commit: a7f5d8be9b4d131f801ca3716d9843363f4df875 gpu: AMD Radeon RX 9070 XT title: A newer retail game seconds: 60 exit: 0x0 frames shown: 1681 (PresentX 1681) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14833 MB ``` **Not tested** - In-game world gameplay beyond the 60-second startup/menu smoke run (`XCL_NETWORK=0`) and NVIDIA / wave32-only GPUs. **AI use** - AI-assisted implementation and synthetic unit tests; human diff review and RX 9070 XT smoke verification completed.
DavidM1911 commented 2026-11-24 19:07:42 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-24T18:52:41Z.


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 unmodified main.)

Thanks!

<!-- greyfinch-sync:ivall/xcl:comment:7141277579 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1446#issuecomment-7141277579). Originally posted by [DavidM1911](https://github.com/DavidM1911) on 2026-11-24T18:52:41Z. --- 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 unmodified `main`.) Thanks!
Belox17 commented 2026-11-24 21:09:14 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Belox17 on 2026-11-24T20:03:04Z.


Test report for a7f5d8be on NVIDIA (RTX 3060 Ti): passes on NVIDIA too, and the test fails without the fix

Tested

  • NVIDIA GeForce RTX 3060 Ti 8 GB (32-lane waves), driver 32.0.16.2124; Ryzen 5 5600X; Windows 11 build 26300; rustc 1.98.1 MSVC; DXC 1.8.2502.11 (Windows SDK 10.0.26100); debug build. Head a7f5d8be as is (base b7aa9f3), clean tree.
  • The new test (decoder_rejects_invalid_per_stream_channel_counts) with cargo test -p xcl --lib <name>: 1 passed.
  • cargo test --workspace -- --test-threads=4 on the head: 771 passed, 0 failed, 41 ignored; its base b7aa9f3 on the same machine: 770 passed, 0 failed, 41 ignored. SKIPPED on both: gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware (no wave64).
  • Merged into current main c160d86e (clean merge): 859 passed, 0 failed, 42 ignored; main alone: 858 passed, 0 failed, 42 ignored, the same three SKIPPED as above.
  • With the guard in hle/xma2/mod.rs reverted (test kept), the test fails: assertion failed: Decoder::new(cfg).is_err().

Not tested

  • AMD / native wave64 hardware; any retail title (no smoke run).

AI use: Claude Code (Claude Opus 5.5) ran the commands on this machine and wrote this report from those runs.

<!-- greyfinch-sync:ivall/xcl:comment:7142970931 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1446#issuecomment-7142970931). Originally posted by [Belox17](https://github.com/Belox17) on 2026-11-24T20:03:04Z. --- **Test report for `a7f5d8be` on NVIDIA (RTX 3060 Ti): passes on NVIDIA too, and the test fails without the fix** **Tested** - NVIDIA GeForce RTX 3060 Ti 8 GB (32-lane waves), driver 32.0.16.2124; Ryzen 5 5600X; Windows 11 build 26300; rustc 1.98.1 MSVC; DXC 1.8.2502.11 (Windows SDK 10.0.26100); debug build. Head `a7f5d8be` as is (base `b7aa9f3`), clean tree. - The new test (`decoder_rejects_invalid_per_stream_channel_counts`) with `cargo test -p xcl --lib <name>`: 1 passed. - `cargo test --workspace -- --test-threads=4` on the head: **771 passed, 0 failed, 41 ignored**; its base `b7aa9f3` on the same machine: 770 passed, 0 failed, 41 ignored. SKIPPED on both: `gpu_geometry_wave32_prefix_count_over_a_mask`, `gpu_wave32_program_in_wave64_hardware` (no wave64). - Merged into current `main` `c160d86e` (clean merge): **859 passed, 0 failed, 42 ignored**; `main` alone: 858 passed, 0 failed, 42 ignored, the same three SKIPPED as above. - With the guard in `hle/xma2/mod.rs` reverted (test kept), the test fails: `assertion failed: Decoder::new(cfg).is_err()`. **Not tested** - AMD / native wave64 hardware; any retail title (no smoke run). **AI use:** Claude Code (Claude Opus 5.5) ran the commands on this machine and wrote this report from those runs.
upipibi commented 2026-11-26 16:07:49 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by upipibi on 2026-11-26T16:07:49Z.


NVIDIA test report for a7f5d8b: RTX 3070 8 GB (Ampere, driver 616.56), Windows 11 26100, Rust 1.100.0, debug. Head tested as-is on its base b7aa9f3.

  • cargo test -p xcl --lib -- --skip hle::xaudio2 --test-threads=4: 714 passed, 0 failed, 21 ignored; 2 SKIPPED (no wave64), not in this PR's files.
  • cargo test -p xcl --lib -- --exact hle::xma2::tests::decoder_rejects_invalid_per_stream_channel_counts --test-threads=1 --nocapture, 3 runs: 3/3 passed, 0 SKIPPED.
    Lib tests only; no title run.
    AI-assisted (Claude Code, Claude Opus 5.5).
<!-- greyfinch-sync:ivall/xcl:comment:7197221078 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1446#issuecomment-7197221078). Originally posted by [upipibi](https://github.com/upipibi) on 2026-11-26T16:07:49Z. --- NVIDIA test report for `a7f5d8b`: RTX 3070 8 GB (Ampere, driver 616.56), Windows 11 26100, Rust 1.100.0, debug. Head tested as-is on its base `b7aa9f3`. - `cargo test -p xcl --lib -- --skip hle::xaudio2 --test-threads=4`: 714 passed, 0 failed, 21 ignored; 2 SKIPPED (`no wave64`), not in this PR's files. - `cargo test -p xcl --lib -- --exact hle::xma2::tests::decoder_rejects_invalid_per_stream_channel_counts --test-threads=1 --nocapture`, 3 runs: 3/3 passed, 0 SKIPPED. Lib tests only; no title run. AI-assisted (Claude Code, Claude Opus 5.5).
Decodere commented 2026-11-27 12:30:38 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Decodere on 2026-11-27T12:30:38Z.


Independent desktop NVIDIA verification of PR #1446 at head a7f5d8be9b4d131f801ca3716d9843363f4df875 (1 commit; exact parent & merge-base: b7aa9f3bd212088e0d927439284dc5ed325ce3c7, pre-#2555 ancestor of main).

Environment

  • GPU: NVIDIA GeForce RTX 4060 (8 GB / 7956 MiB reported by D3D12, Wave32-only Ada), driver 32.0.16.2114 (NVIDIA 621.14, WDDM 3.2)
  • CPU / RAM / OS: Intel Core i5-11400F (6C / 12T), 32 GB RAM (31.9 GiB usable), Windows 11 Home 26200 (Developer Mode off)
  • Toolchain: rustc 1.100.0 (0ef1bc386 2026-11-09) MSVC, DXC 1.9.2609.5, --release

Targeted tests & build (a7f5d8be)

Command Result
cargo test --release -p xcl --lib decoder_rejects_invalid_per_stream_channel_counts -- --nocapture (3 consecutive runs) 1 passed; 0 failed; 0 ignored; 743 filtered out × 3 (0.00s, 0.00s, 0.00s, 0 skipped)
cargo test --release -p xcl --lib hle::xma2:: -- --nocapture (3 consecutive runs) 8 passed; 0 failed; 0 ignored; 736 filtered out × 3 (0.00s, 0.00s, 0.00s, 0 skipped)
cargo build --release -p xcl Clean build (1m 05s, exit 0, 0 new warnings in xma2/mod.rs)

Paired quiet 60 s retail smoke (title: 29640639)

(Note: scripts/smoke.ps1 at b7aa9f3b predates 9683e7a6 and printed the local folder basename on title:; replaced below with the standard 9683e7a6 title hash 29640639, with all measured fields verbatim.)

Exact parent & merge-base (b7aa9f3bd212088e0d927439284dc5ed325ce3c7):

xcl-smoke v1
commit: b7aa9f3bd212088e0d927439284dc5ed325ce3c7
gpu: NVIDIA GeForce RTX 4060
title: 29640639
seconds: 60
exit: 0x0
frames shown: 1598 (PresentX 1599)
presents per 2 s (last 3): 60 61 60
device removals: 0
crashes: 0
peak commit: 14719 MB

PR #1446 (a7f5d8be9b4d131f801ca3716d9843363f4df875):

xcl-smoke v1
commit: a7f5d8be9b4d131f801ca3716d9843363f4df875
gpu: NVIDIA GeForce RTX 4060
title: 29640639
seconds: 60
exit: 0x0
frames shown: 1585 (PresentX 1585)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14720 MB

Limits of coverage

  • decoder_rejects_invalid_per_stream_channel_counts and all 8/8 hle::xma2:: unit tests (0 skipped) passed 3/3, directly verifying rejection of invalid per-stream XMA channel counts.
  • The 60 s retail smoke confirms steady 60 Hz runtime non-regression (0 device removals, 0 crashes); single-run frame/commit delta vs. parent reflects normal startup variance.

AI disclosure: test execution and report drafting assisted by Google Antigravity (Gemini 4 Neon).

<!-- greyfinch-sync:ivall/xcl:comment:7218326998 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1446#issuecomment-7218326998). Originally posted by [Decodere](https://github.com/Decodere) on 2026-11-27T12:30:38Z. --- Independent desktop NVIDIA verification of **PR #1446** at head `a7f5d8be9b4d131f801ca3716d9843363f4df875` (`1` commit; exact parent & merge-base: `b7aa9f3bd212088e0d927439284dc5ed325ce3c7`, pre-`#2555` ancestor of `main`). ### Environment - **GPU:** NVIDIA GeForce RTX 4060 (8 GB / `7956 MiB` reported by D3D12, Wave32-only Ada), driver `32.0.16.2114` (NVIDIA `621.14`, WDDM 3.2) - **CPU / RAM / OS:** Intel Core i5-11400F (6C / 12T), 32 GB RAM (`31.9 GiB` usable), Windows 11 Home `26200` (Developer Mode off) - **Toolchain:** `rustc 1.100.0 (0ef1bc386 2026-11-09)` MSVC, DXC `1.9.2609.5`, `--release` ### Targeted tests & build (`a7f5d8be`) | Command | Result | | --- | --- | | `cargo test --release -p xcl --lib decoder_rejects_invalid_per_stream_channel_counts -- --nocapture` (3 consecutive runs) | `1 passed; 0 failed; 0 ignored; 743 filtered out` × 3 (`0.00s`, `0.00s`, `0.00s`, `0` skipped) | | `cargo test --release -p xcl --lib hle::xma2:: -- --nocapture` (3 consecutive runs) | `8 passed; 0 failed; 0 ignored; 736 filtered out` × 3 (`0.00s`, `0.00s`, `0.00s`, `0` skipped) | | `cargo build --release -p xcl` | Clean build (`1m 05s`, exit `0`, `0` new warnings in `xma2/mod.rs`) | ### Paired quiet 60 s retail smoke (`title: 29640639`) *(Note: `scripts/smoke.ps1` at `b7aa9f3b` predates `9683e7a6` and printed the local folder basename on `title:`; replaced below with the standard `9683e7a6` title hash `29640639`, with all measured fields verbatim.)* Exact parent & merge-base (`b7aa9f3bd212088e0d927439284dc5ed325ce3c7`): ``` xcl-smoke v1 commit: b7aa9f3bd212088e0d927439284dc5ed325ce3c7 gpu: NVIDIA GeForce RTX 4060 title: 29640639 seconds: 60 exit: 0x0 frames shown: 1598 (PresentX 1599) presents per 2 s (last 3): 60 61 60 device removals: 0 crashes: 0 peak commit: 14719 MB ``` PR #1446 (`a7f5d8be9b4d131f801ca3716d9843363f4df875`): ``` xcl-smoke v1 commit: a7f5d8be9b4d131f801ca3716d9843363f4df875 gpu: NVIDIA GeForce RTX 4060 title: 29640639 seconds: 60 exit: 0x0 frames shown: 1585 (PresentX 1585) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14720 MB ``` ### Limits of coverage - `decoder_rejects_invalid_per_stream_channel_counts` and all `8/8` `hle::xma2::` unit tests (`0` skipped) passed `3/3`, directly verifying rejection of invalid per-stream XMA channel counts. - The 60 s retail smoke confirms steady 60 Hz runtime non-regression (`0` device removals, `0` crashes); single-run frame/commit delta vs. parent reflects normal startup variance. *AI disclosure: test execution and report drafting assisted by Google Antigravity (Gemini 4 Neon).*
BBareth commented 2026-11-30 13:11:37 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by BBareth on 2026-11-30T13:11:37Z.


merge-check claim
head: a7f5d8be9b

<!-- greyfinch-sync:ivall/xcl:comment:7279488026 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1446#issuecomment-7279488026). Originally posted by [BBareth](https://github.com/BBareth) on 2026-11-30T13:11:37Z. --- merge-check claim head: a7f5d8be9b4d131f801ca3716d9843363f4df875
BBareth commented 2026-11-30 13:22:08 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by BBareth on 2026-11-30T13:22:08Z.


merge-check
base: 9dfbe3ea66
head: a7f5d8be9b
merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2886 passed, 1 failed, 51 ignored; failing: gpu::dxil::msaa_tests::gpu_direct_image_get_resinfo_d16, which fails on the base alone too (base: 2885 passed, 1 failed, 51 ignored, 28 SKIPPED lines). 28 SKIPPED lines, as on the base. The new test hle::xma2::tests::decoder_rejects_invalid_per_stream_channel_counts passed, as did the existing xma2 tests.
review: no blocking finding; one file, every hunk read. Decoder::new now refuses a configuration in which any stream has zero or more than MAX_CHANNELS_PER_STREAM channels; before, only the stream count and the sum were checked, so [0, 2] for 2 channels or [3] for 3 passed. The test covers zero, three in one stream and 1 + 3, and keeps a valid XMA1 2 + 1 layout accepted. The error text says "one or two channels" while the code uses the constant; the two agree today.
performance: none: one pass over at most MAX_STREAMS bytes at decoder creation.
verdict: safe to merge
hardware / tool and model: RTX 5070 Ti 16 GB, driver 621.24 (32.0.16.2124); i7-12700K; Windows 11 26200. Claude Code, Claude Fable 5.2 read the diff, ran the build and the suite and wrote this check.

<!-- greyfinch-sync:ivall/xcl:comment:7279744217 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1446#issuecomment-7279744217). Originally posted by [BBareth](https://github.com/BBareth) on 2026-11-30T13:22:08Z. --- merge-check base: 9dfbe3ea6653a9c76ef3ea0d66187a4b5407483b head: a7f5d8be9b4d131f801ca3716d9843363f4df875 merge: clean build: cargo build --workspace -> ok tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2886 passed, 1 failed, 51 ignored; failing: gpu::dxil::msaa_tests::gpu_direct_image_get_resinfo_d16, which fails on the base alone too (base: 2885 passed, 1 failed, 51 ignored, 28 SKIPPED lines). 28 SKIPPED lines, as on the base. The new test `hle::xma2::tests::decoder_rejects_invalid_per_stream_channel_counts` passed, as did the existing xma2 tests. review: no blocking finding; one file, every hunk read. `Decoder::new` now refuses a configuration in which any stream has zero or more than `MAX_CHANNELS_PER_STREAM` channels; before, only the stream count and the sum were checked, so `[0, 2]` for 2 channels or `[3]` for 3 passed. The test covers zero, three in one stream and 1 + 3, and keeps a valid XMA1 2 + 1 layout accepted. The error text says "one or two channels" while the code uses the constant; the two agree today. performance: none: one pass over at most `MAX_STREAMS` bytes at decoder creation. verdict: safe to merge hardware / tool and model: RTX 5070 Ti 16 GB, driver 621.24 (32.0.16.2124); i7-12700K; Windows 11 26200. Claude Code, Claude Fable 5.2 read the diff, ran the build and the suite and wrote this check.
tiagonleal commented 2026-11-30 14:11:20 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by tiagonleal on 2026-11-30T14:11:20Z.


merge-check
base: 9dfbe3ea66
head: a7f5d8be9b
merge: clean, alone and together with #1451 (58b4e756) and #1458 (afaca49b): the three heads merged onto the base in one tree (c48c9d04) without conflicts; also no conflict between that tree and #926 (open, touches opus.rs but not these functions)
build: cargo build --workspace -> ok on the combined tree (also cargo build --release -p xcl)
tests: cargo test --workspace --no-fail-fast -j 8 -- --test-threads=4 on the combined tree of the three heads above on the base (one suite run for the three PRs, not one per PR) -> 2888 passed, 1 failed, 51 ignored; SKIPPED: 24 lines, the same as on the base; failing: gpu::dxil::msaa_tests::gpu_direct_image_get_resinfo_d16, which fails the same way on the base alone (2885 passed, 1 failed, 51 ignored; #3513 fixes it). hle::xma2::tests::decoder_rejects_invalid_per_stream_channel_counts ran and passed. With the new check replaced by if false, it fails at xma2/mod.rs:2475; file restored after.
review: one file, whole diff read. What this adds to the first check: no format a title can pass reaches the new error. Decoder::new (xma2/mod.rs:1840) is fed in production only from xma_stream_config (xaudio2.rs:340-355), and all its builders already keep each stream at one or two channels: the 34-byte XMA2 path computes 1 or 2 per stream (xma2/mod.rs:86-99), the legacy XMA2 path refuses 0 or more than MAX_CHANNELS_PER_STREAM (xma2/mod.rs:116), and so does XMA1 (xma2/mod.rs:153-155). The check therefore protects direct users of the public constructor (and the tests), and matches the bound the builders and the per-stream decoders already use (MAX_CHANNELS_PER_STREAM = 2, xma2/mod.rs:24). If it ever fires, the caller handles the error: xaudio2.rs:1001 logs "XMA decoder init failed" and the voice is created as silent PCM16 (xaudio2.rs:1007-1011).
performance: scripts/smoke.ps1, 60 s of a retail title, release, combined tree of the three heads: 1597 frames and 17767 MB peak commit against 1659 frames and 17322 MB on the base (today's base run after one warm-up; a later traced base run gave 1670 frames, 18142 MB). No device removal, no crash. Audio initialised as on the base: the same acphal and xapu lines (ApuCreateHeap, DSP connected with 128 streams, audio processor connected, xapu: decoder connected with 256 streams). Neither run logs an XAudio2 XMA or Opus voice, so the title creates no such voice in its menus and nothing was rejected that the base accepted. The frame count is inside the 80 % rule; I did not rerun to see whether the lower count repeats.
verdict: safe to merge
hardware / tool and model: RTX 5070 Ti 16 GB (617.42, wave32), Ryzen 7 9800X3D, 32 GB, Windows 11 26300, rustc 1.100.0 / Claude Code (Claude Opus 5.5 ran the build, suite, tests and smoke, reviewed the diff against the merged source and wrote this)

  • Tiago
<!-- greyfinch-sync:ivall/xcl:comment:7280974794 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1446#issuecomment-7280974794). Originally posted by [tiagonleal](https://github.com/tiagonleal) on 2026-11-30T14:11:20Z. --- merge-check base: 9dfbe3ea6653a9c76ef3ea0d66187a4b5407483b head: a7f5d8be9b4d131f801ca3716d9843363f4df875 merge: clean, alone and together with #1451 (58b4e756) and #1458 (afaca49b): the three heads merged onto the base in one tree (c48c9d04) without conflicts; also no conflict between that tree and #926 (open, touches `opus.rs` but not these functions) build: cargo build --workspace -> ok on the combined tree (also `cargo build --release -p xcl`) tests: cargo test --workspace --no-fail-fast -j 8 -- --test-threads=4 on the combined tree of the three heads above on the base (one suite run for the three PRs, not one per PR) -> 2888 passed, 1 failed, 51 ignored; SKIPPED: 24 lines, the same as on the base; failing: `gpu::dxil::msaa_tests::gpu_direct_image_get_resinfo_d16`, which fails the same way on the base alone (2885 passed, 1 failed, 51 ignored; #3513 fixes it). `hle::xma2::tests::decoder_rejects_invalid_per_stream_channel_counts` ran and passed. With the new check replaced by `if false`, it fails at `xma2/mod.rs:2475`; file restored after. review: one file, whole diff read. What this adds to the first check: no format a title can pass reaches the new error. `Decoder::new` (`xma2/mod.rs:1840`) is fed in production only from `xma_stream_config` (`xaudio2.rs:340-355`), and all its builders already keep each stream at one or two channels: the 34-byte XMA2 path computes 1 or 2 per stream (`xma2/mod.rs:86-99`), the legacy XMA2 path refuses 0 or more than `MAX_CHANNELS_PER_STREAM` (`xma2/mod.rs:116`), and so does XMA1 (`xma2/mod.rs:153-155`). The check therefore protects direct users of the public constructor (and the tests), and matches the bound the builders and the per-stream decoders already use (`MAX_CHANNELS_PER_STREAM` = 2, `xma2/mod.rs:24`). If it ever fires, the caller handles the error: `xaudio2.rs:1001` logs "XMA decoder init failed" and the voice is created as silent PCM16 (`xaudio2.rs:1007-1011`). performance: `scripts/smoke.ps1`, 60 s of a retail title, release, combined tree of the three heads: 1597 frames and 17767 MB peak commit against 1659 frames and 17322 MB on the base (today's base run after one warm-up; a later traced base run gave 1670 frames, 18142 MB). No device removal, no crash. Audio initialised as on the base: the same `acphal` and `xapu` lines (ApuCreateHeap, DSP connected with 128 streams, audio processor connected, `xapu: decoder connected` with 256 streams). Neither run logs an XAudio2 XMA or Opus voice, so the title creates no such voice in its menus and nothing was rejected that the base accepted. The frame count is inside the 80 % rule; I did not rerun to see whether the lower count repeats. verdict: safe to merge hardware / tool and model: RTX 5070 Ti 16 GB (617.42, wave32), Ryzen 7 9800X3D, 32 GB, Windows 11 26300, rustc 1.100.0 / Claude Code (Claude Opus 5.5 ran the build, suite, tests and smoke, reviewed the diff against the merged source and wrote this) - Tiago
Foniass commented 2026-12-01 05:46:54 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T05:46:54Z.


Triage (#1607) – head a7f5d8b

#1886 made the same per-stream channel check in xma2::Decoder::new and was closed as a duplicate of this PR. No other open or merged PR makes this change.
The StreamConfig constructors on main (from_xma2_wfx and the legacy/XMA1 parsers) already reject 0 or more than 2 channels per stream. This check guards direct Decoder::new callers. No problems found in the diff.
Recommendation: keep open.

AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.

<!-- greyfinch-sync:ivall/xcl:comment:7302131369 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1446#issuecomment-7302131369). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T05:46:54Z. --- **Triage (#1607)** – head a7f5d8b #1886 made the same per-stream channel check in `xma2::Decoder::new` and was closed as a duplicate of this PR. No other open or merged PR makes this change. The `StreamConfig` constructors on `main` (`from_xma2_wfx` and the legacy/XMA1 parsers) already reject 0 or more than 2 channels per stream. This check guards direct `Decoder::new` callers. No problems found in the diff. Recommendation: keep open. AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
xcl-dev/xcl!1436
No description provided.