hle/opus: honor Ogg Opus EOS granule trimming and pre-skip #109
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/110"
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 certified-retart on 2026-11-23T11:45:48Z.
Summary
Honors RFC 7845 Ogg Opus end trimming (
EOSgranule position) andOpusHeadpre-skip for complete, contiguous Ogg Opus submissions incrates/xcl/src/hle/opus.rs.Previously,
extract_ogg_opusflattened Ogg pages into raw packets and dropped page granule positions, causing decoded PCM andestimate_buffer_framesto include trailing padding samples past the final granule (and to ignore the OggOpusHeadpre-skip when the voice format had noextra_data).Changes
OggTiming+ contiguous Ogg page validation (extract_ogg_opus):OpusHead,OpusTags, continued packets across page boundaries, and exact granule deltas across pages.pre_skiptoend_48kper §4.2 sogranule <= pre_skipyields 0 frames without underflow.u128scaling inframes_at_rateto avoid overflow.Decoder::decode_buffer,OggTiming::trim_pcm):OggTimingonly at a decoder stream boundary (timestamp_100ns == 0) with matching channel/mapping/gain configuration, and only when the MFT produced the complete expected decoded timeline (so buffered/primed short outputs keep the existing fallback path).OpusHeadpre-skip once (never double-skipping) and updatesestimate_buffer_framesto use the same trimmed window.ogg_eos_frame_estimate_handles_preskip_and_initial_granules(includinggranule < pre_skip,granule == pre_skip, initial granule offset, and 24 kHz scaling)ogg_timing_requires_one_complete_contiguous_linkogg_timing_counts_continued_packet_on_its_completion_pageogg_pcm_trim_requires_full_mft_outputdecode_ogg_eos_matches_raw_pcm_window_mono_and_stereo(liveMSOpusDecoder.dllcheck with both empty andOpusHeadextra_data)Verification
cargo test -p xcl --lib -- --test-threads=1: 500 passed, 0 failed, 16 ignoredcargo test -p xcl --test e2e -- --test-threads=1: 2 passed, 0 failedImported from ivall/xcl. Originally posted by ivall on 2026-11-23T14:14:03Z.
Merged. Checked on Windows 11 with an RX 9070 (RDNA4), merged together with the rest of #110–#129:
cargo test --workspacegreen with the retail samples (shader pack, console DLLs, texture archive), lib tests also withXCL_SPLIT_WAVE64=1; the retail pack still translates 26 698 / 26 698; the FSR4 GPU probe passes; Unicorn Overlord and XDefiant run. Thanks!