Repository navigation
hle/opus: honor Ogg Opus EOS granule trimming and pre-skip - #110
Merged
Merged
Conversation
ivall
added a commit
that referenced
this pull request
Nov 23, 2026
Collaborator
|
Merged. Checked on Windows 11 with an RX 9070 (RDNA4), merged together with the rest of #110–#129: |
This was referenced Nov 23, 2026
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 failed