diff options
| author | Kam471 <115741199+Kam471@users.noreply.github.com> | 2026-11-22 11:31:02 +0000 |
|---|---|---|
| committer | Kam471 <115741199+Kam471@users.noreply.github.com> | 2026-11-22 11:31:02 +0000 |
| commit | 73552dfcd3bd0a63fcde91cc17c0f24838f82ef1 (patch) | |
| tree | 45d466d96003628f1857a0d1380a4297d1c9b0f4 /runtime/src/thread_stacks.cpp | |
| parent | c2967a5e60060e4068fb992196d8f4b494a5046c (diff) | |
audio: write the Opus pre-skip and correct plain-stream lengths (ASSET-104)
OpusHead declared pre-skip 0, so every exported stream started with 312
samples of libopus priming and the end trim removed the same amount of real
audio. Write the lookahead (312 by default, --pre-skip overrides it) and make
the trimmed final granule pre_skip + length.
The plain-stream length also scaled the format tag's sample count by
48000/rate and ignored stereo interleaving. Measured over 1,598,151 plain
streams: packet samples - declared is 1920..2879 for every 48 kHz and 32 kHz
stream, which is only possible if the declared count is already 48 kHz frames;
after halving stereo counts the same 1920..2879 window holds for all 17,983
stereo streams. Scaling a 32 kHz stream by 1.5 left the padding untrimmed.
Tests cover the pre-skip, the 48 kHz frame count, stereo halving and the
--pre-skip bounds. libopus round-trip: the fixed output matches the reference
Ogg sample-for-sample (max |diff| 0); before the fix it was shifted 312
samples and differed by up to 12,188.
Diffstat (limited to 'runtime/src/thread_stacks.cpp')
0 files changed, 0 insertions, 0 deletions