Opus: prefer length-prefixed framing, fix 6.1 mapping, harden MFT (#327) #503
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!503
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-503"
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?
@Grimkaaah on GitHub · 2026-11-24 01:03 UTC · original
Grimkaaah:fix/327-opus-framing-mapping-mft→main· +55 −12 · 1 files · 1 commits · openSummary
try_length_prefixed_blocksucceeds, so an exact-fit[u16 LE len][pkt]is not misread as one raw RFC 6716 packet whose TOC is the length prefix (#327).(streams=5, coupled=2)instead of(4, 3).MftDecoder::configure_outputkeeps the configured channel count;drain_outputcapsMF_E_TRANSFORM_STREAM_CHANGEreconfigs at 4.Fixes #327
Test plan
cargo test -p xcl --lib hle::opus::(15 passed, including new framing + 6.1 mapping tests)github-bot referenced this pull request2026-11-26 04:59:09 +00:00
@H0UNDZER0 on GitHub · 2026-11-24 02:40 UTC · original
Tested on an RTX 5080, release build: pass, 679 passed, 0 failed, with Windows' own Opus decoder.
78f55101c6e97f58ac30782d4bfebc76c4a2bc28, this PR's head as is (on its base7ebf1b8), release build.XCL_*variables set.cargo build --release --workspace --locked: OK, the same singlefetch_updatewarning asmain.cargo test --workspace --release --no-fail-fast --locked -- --test-threads=4, run twice (the second with--show-output): 679 passed, 0 failed, 41 ignored both times. The base7ebf1b8gives 677 / 0 / 41 here: the difference is the 2 new tests,length_prefixed_single_packet_preferred_over_raw_toc_lookalikeandvorbis_mapping_6_1_matches_rfc7845, which pass with the other 13opustests.SKIPPED: the usual 2,gpu_geometry_wave32_prefix_count_over_a_maskandgpu_wave32_program_in_wave64_hardware(no wave64).e2e) checks its XAudio2 voices here (an audio device is present): its Opus voice decodes throughMSOpusDecoder(Media Foundation), and the title ends withfailures: 0.Not tested
XCL_SAMPLE_AWCnot set), and a 6.1 stream through the Media Foundation decoder.main. At the time of the run that was9ce2070;git merge-treeshowed no conflict.scripts/smoke.ps1.AI use: Claude Code (Claude Opus 5.5, Claude Fable 5.2)
@MesshM on GitHub · 2026-11-24 04:14 UTC · original
Test run and review of
78f55101c6e97f58ac30782d4bfebc76c4a2bc28on AMD RDNA4. I merged it onto currentmainf4ce27clocally (clean merge) and tested that tree.Tested
stable-x86_64-pc-windows-msvc, debugcargo build --workspace+cargo test --workspace -- --test-threads=4on the merge: 703 passed, 0 failed, 41 ignored, exit code 0; 0SKIPPED; theopustests pass, includinglength_prefixed_single_packet_preferred_over_raw_toc_lookalikeandvorbis_mapping_6_1_matches_rfc7845.Review: the 6.1 mapping change looks wrong to me (the same change as #506, where I left the details). The new comment says "RFC 7845 / libopus 6.1: 5 streams (2 coupled + 3 mono)". libopus's table (
src/opus_multistream_encoder.c,vorbis_mappings[8], currentxiph/opusmaster) has for 7 channels{4, 3, {0, 4, 1, 2, 3, 5, 6}}, i.e. 4 streams, 3 coupled, which is whatmainhas now. RFC 7845 leaves the counts to the encoder for family 1, and theOpusHeadhas to declare the counts the packets were encoded with, so without a 6.1 sample from a title showing 5 / 2 I would keep 4 / 3 and dropvorbis_mapping_6_1_matches_rfc7845(it pins the new value). This PR and #506 also overlap on that line.The rest (preferring a length-prefixed single packet over a raw TOC look-alike, and the hardening) is separate from the mapping; splitting it out would let it land on its own, as CONTRIBUTING asks (one change per PR).
Not tested: no Opus stream from a title (I have no game data); release build.
Run and review by Claude Code (Claude Opus 5.5) on this machine; the libopus table was read from its repository.
@mastrr9 on GitHub · 2026-11-24 05:05 UTC · original
Independent NVIDIA RTX 5080 build/test run and code review at head
78f55101c6e97f58ac30782d4bfebc76c4a2bc28(fixing our#327report).Code Review
#327:[u16 len][pkt]framing ahead of raw TOC lookalikes.vorbis_mapping(7) => (5, 2)matching RFC 7845).MftDecoder::configure_outputbych == self.channelsand boundsMF_E_TRANSFORM_STREAM_CHANGEretries withMAX_STREAM_CHANGES = 4.Tested
617.42/32.0.16.1742), Windows 11 Pro 25H2 (26200.9974),rustc 1.100.0 (0ef1bc386 2026-11-09), debug build.cargo build --workspace && cargo test --workspace -- --test-threads=4ok):hle::opus::tests::length_prefixed_single_packet_preferred_over_raw_toc_lookalikehle::opus::tests::vorbis_mapping_6_1_matches_rfc7845hle::opus::tests::*tests.gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask(no wave64)gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware(no wave64)test_title_draws_with_a_root_signature_under_the_debug_layer(no d3d12SDKLayers.dll)uploads_start_from_each_subresources_state(no D3D12 debug layer (0x887A002D))Not tested
STREAM_CHANGE/ retail audio streams.AI use: Antigravity (Gemini 4 Neon) performed the code review, ran the RTX 5080 workspace tests, and drafted this comment.
@wilu222 on GitHub · 2026-11-24 13:53 UTC · original · edited 2026-11-25 02:48 UTC
Retail-title regression runs for
78f55101c6e97f58ac30782d4bfebc76c4a2bc28(this PR's head as is, on its base7ebf1b8), since the PR has none yet.Tested
cargo test -p xcl --lib opuson the head: 17 passed, 0 failed.XCL_NETWORK=0,scripts/smoke.ps1 -Seconds 120, no input: the two blocks below. No crash or device removal; frames and commit within the check's limits.XCL_PRESS_A_AT=30,45,60), which start the world load and, about 75 s later, the opening cutscene's Opus audio:main47efa2e(clean merge, local only): 3,095 Opus packets decoded, 0 errors, non-zero samples. The run then ended at 107 s in the knownxg::copy_fromaccess violation (#662, fixed by #684), not in Opus code.7ebf1b8alone reached the cutscene at about 112 s. The runs are identical up to 100 s (the same 18,902 DirectStorage requests by 30 s, then waiting). The PR runs reach the same later milestone about 8 s behind the base, so the cut-off falls before the cutscene. The PR's code decoded one packet before that point, so I don't read this as a regression; a longer run would show it.Regression run
main:
PR:
Not tested
main; it merges cleanly.AI use
@throny on GitHub · 2026-11-25 10:16 UTC · original
Two contributors checked independently and found that #926 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.
@DavidM1911 on GitHub · 2026-11-25 13:53 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.