Opus: only take MFT output types with the decoder's channel count, cap stream-change retries #920
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/926"
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 DavidM1911 on 2026-11-24T08:29:03Z.
Part of #327 (item 3).
Two guards on the Media Foundation MFT path in
crates/xcl/src/hle/opus.rs:MftDecoder::configure_outputaccepted the first PCM16/Float32 output type without checkingMF_MT_AUDIO_NUM_CHANNELSagainst the decoder's channel count, then overwroteself.channels— a multistream interleave sized for the expected count could index past the buffer if the MFT enumerated a different count first. Output types whose channel count differs are now skipped; a missingNUM_CHANNELSstill defaults to the decoder's count as before.MftDecoder::drain_outputretriedMF_E_TRANSFORM_STREAM_CHANGEin an unbounded loop; it now gives up after 4 reconfigurations.What is in it
crates/xcl/src/hle/opus.rsonly. No new unit test: both paths need a liveIMFTransform, which the crate's tests do not mock; the existing Opus/MFT tests still pass.Tested
x86_64-pc-windows-msvc:cargo test -p xcl --lib opus: 15 passed, 0 failedcargo test --workspace -- --test-threads=4: 676 passed, 0 failed, 41 ignoredscripts/smoke.ps1 -Seconds 60,cargo build --release -p xcl:main
a6f5f7a(same baseline as the sibling PRs; upstream/main is now2997c9a, docs-only on top):this PR's head
8d0176d:Not tested
AI use
Imported from ivall/xcl. Originally posted by SlopTart on 2026-11-24T10:37:35Z.
Linux / AMD RDNA3 datapoint.
Merged state: head
8d0176donto main9aec53d, clean merge.Full suite,
cargo test --workspace --release --no-fail-fast --target x86_64-pc-windows-gnu -- --test-threads=4: 717 passed, 7 failed, 41 ignored; failures are the known Wine-lane set from my #42 rows. Opus MFT output-type gating green.Not tested: retail titles (none here), Windows, RDNA4.
Counts only, no game data.
Machine: RX 7900 XT (RADV NAVI31), Mesa 26.2.5, kernel 7.2 (Arch), Proton Experimental (wine-11.0), patched vkd3d-proton v3.1, Rust cross
x86_64-pc-windows-gnu,XCL_NETWORK=0, release profile,--test-threads=4. My Linux rows: #42 / #718.AI use: Hermes agent (local Qwen-class) ran the suite and drafted this; I checked it before posting.
Imported from ivall/xcl. Originally posted by throny on 2026-11-25T10:16:42Z.
Two contributors checked independently and found that #503 solves the same problem (for #327) in a different way: #1607, group D12. You may want to compare them with the other author and agree on one, or say in the PR why both are needed.
This is a hint from the community triage in #1607, not a maintainer decision.
AI use: Claude Code (Claude Opus 5.5), posted by a script from the #1607 table.
Imported from ivall/xcl. Originally posted by throny on 2026-11-29T09:36:52Z.
merge-check claim
head:
8d0176d9b8Imported from ivall/xcl. Originally posted by throny on 2026-11-29T09:41:20Z.
merge-check
base:
d8bd9a38head:
8d0176d9b8merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2618 passed, 0 failed, 49 ignored: the base's count, the change has no test of its own (27 SKIPPED lines). Base alone at
d8bd9a38: 2618 passed, 0 failed, 49 ignored.review: no finding (read by me, 16 added lines). An output type whose channel count differs from the decoder's is skipped when the output is configured, instead of being taken and panicking later where the channels are interleaved; and a stream-change reply that keeps coming back after reconfiguring ends in an error after four rounds instead of looping. No test, which is understandable for a path that needs the system's decoder to misbehave.
performance: none.
verdict: safe to merge
hardware / tool and model: RTX 4080 16 GB (621.40), i9-12900K, Windows 11 26300, Rust 1.100.0, debug. Claude Code; merge, build and suite run by Claude Fable 5.2, diff review by Claude Opus 5.5 (every hunk read; nothing run on the GPU beyond the suite).
Imported from ivall/xcl. Originally posted by tiagonleal on 2026-11-30T02:49:08Z.
merge-check
base:
cb8024684chead:
8d0176d9b8merge: clean
build: cargo build --workspace -> ok (also
cargo build --release -p xcl)tests: cargo test --workspace --no-fail-fast -j 8 -- --test-threads=4 -> 2809 passed, 1 failed, 51 ignored; SKIPPED: 27 lines (22
no wave64, 3 f16/f32 per-lane cases refused, 2no heap windows), the same as on the base; failing:hle::d3d12x::standin::tests::concurrent_shell_miss_reuses_winner_and_releases_loser_pipeline, which fails the same way on the base (it came in with #2369; #3474 fixes it). Base alone on this PC: 2809 passed, 1 failed, 51 ignored.review: whole diff read (+10/-0,
opus.rs). Output types of the system decoder whose channel count differs from the decoder's are skipped. If every type is skippedconfigure_outputreturns an error: at construction that falls back to libopus, and after a stream change it reaches the caller as a decode error, so nothing loops.drain_outputnow gives up with an error after more than fourMF_E_TRANSFORM_STREAM_CHANGEreplies in one call, where it could loop without end before. Buffer sizing is unchanged. No test, which is fair here: it would need a system decoder that misbehaves. One thing for whoever merges: open #503 hardens the same decoder in the same file, so the second of the two to merge will need a rebase. I agree with the earlier check on this head.performance: none. Measured with
scripts/smoke.ps1, 60 s of a retail title, release: 1680 frames and 15884 MB peak commit against 1662 and 1684 frames, 16196 and 15752 MB on the base. No device removal, no crash. That title's first minute may not decode Opus through this path, so the run is a regression check only.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 Fable 5.2 ran the build, suite and smoke and wrote this; Claude Opus 5.5 read the diff first, and I checked its main points in the merged source)
Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T04:30:38Z.
Triage (#1607) – head
8d0176d#503 contains the same two changes in opus.rs (skip MFT output types whose channel count is not
self.channels, cap STREAM_CHANGE retries at 4). It also changes the packet framing and the 7-channel Vorbis mapping to 5 streams / 2 coupled. libopus's table (and main) use 4 streams / 3 coupled for 6.1, so that part of #503 looks wrong. This PR is the minimal fix without that change. No problems found in this diff.Recommendation: keep open.
AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.