Opus: the MFT decoder takes only an output type with its channel count #619

Closed
milas6669 wants to merge 2 commits from upstream-pr/624 into main
milas6669 commented 2026-11-24 02:37:39 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by milas6669 on 2026-11-24T02:37:39Z.


Stacked on #622; only the top commit belongs here.

configure_output took the first PCM16/Float32 output type and overwrote the channel count, which can read out of bounds in the multistream interleave if the MFT lists another count first. It now chooses among the types with the decoder's own count (choose_output_type). drain_output gives up after 4 MF_E_TRANSFORM_STREAM_CHANGE answers instead of looping forever.

Part of #327 (item 3).

What is in it

  • opus.rs: choose_output_type, MAX_STREAM_CHANGES, the two call sites; test output_type_choice_needs_the_decoders_channel_count

Tested

  • RTX 3070, Windows 11 Pro 10.0.26200, MSVC 19.44, Rust 1.100.0, debug build
  • cargo test --workspace -- --test-threads=4: 647 passed, 0 failed, 21 ignored
  • SKIPPED: gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware (no wave64)

Regression run

  • not run: no title on this machine to run scripts/smoke.ps1 against

Not tested

  • AMD, a retail title, scripts/smoke.ps1 main vs PR head
  • the retry cap (no mock MFT), a real multichannel stream through the Windows Opus decoder

AI use

  • Claude Code, Claude Sonnet 5.5: wrote the code, the tests and this description. Reviewed and opened by the person submitting.
<!-- greyfinch-sync:ivall/xcl:issue:6573361404 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/624). Originally posted by [milas6669](https://github.com/milas6669) on 2026-11-24T02:37:39Z. --- Stacked on #622; only the top commit belongs here. `configure_output` took the first PCM16/Float32 output type and overwrote the channel count, which can read out of bounds in the multistream interleave if the MFT lists another count first. It now chooses among the types with the decoder's own count (`choose_output_type`). `drain_output` gives up after 4 `MF_E_TRANSFORM_STREAM_CHANGE` answers instead of looping forever. Part of #327 (item 3). **What is in it** - `opus.rs`: `choose_output_type`, `MAX_STREAM_CHANGES`, the two call sites; test `output_type_choice_needs_the_decoders_channel_count` **Tested** - RTX 3070, Windows 11 Pro 10.0.26200, MSVC 19.44, Rust 1.100.0, debug build - `cargo test --workspace -- --test-threads=4`: 647 passed, 0 failed, 21 ignored - SKIPPED: `gpu_geometry_wave32_prefix_count_over_a_mask`, `gpu_wave32_program_in_wave64_hardware` (no wave64) **Regression run** - not run: no title on this machine to run `scripts/smoke.ps1` against **Not tested** - AMD, a retail title, `scripts/smoke.ps1` main vs PR head - the retry cap (no mock MFT), a real multichannel stream through the Windows Opus decoder **AI use** - Claude Code, Claude Sonnet 5.5: wrote the code, the tests and this description. Reviewed and opened by the person submitting.
upstream-sync closed this pull request 2026-11-24 06:59:13 +00:00
milas6669 commented 2026-11-24 07:05:50 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by milas6669 on 2026-11-24T03:22:36Z.


Closing: #503 already covers the MFT output-type guard and was opened earlier. Please review it instead.

<!-- greyfinch-sync:ivall/xcl:comment:7121029954 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/624#issuecomment-7121029954). Originally posted by [milas6669](https://github.com/milas6669) on 2026-11-24T03:22:36Z. --- Closing: #503 already covers the MFT output-type guard and was opened earlier. Please review it instead.

Pull request closed

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!619
No description provided.