Skip to content

Fix/resampler span boundaries - #916

Closed
phayes wants to merge 2 commits into
RustAudio:masterfrom
phayes:fix/resampler-span-boundaries
Closed

Fix/resampler span boundaries#916
phayes wants to merge 2 commits into
RustAudio:masterfrom
phayes:fix/resampler-span-boundaries

Conversation

@phayes

@phayes phayes commented Aug 6, 2026

Copy link
Copy Markdown

No description provided.

benface and others added 2 commits August 5, 2026 21:17
`fill_input_buffer` treats `current_span_len()` as the samples left in
the span, but it's the span's total length, so it stops reading at the
end of every span. Vorbis packets are smaller than a resampler chunk,
so every chunk ends up short, gets marked `partial_len`, and rubato
pads it with zeros. The same audio comes out different depending on how
the decoder split it.

Stop only where the rate or channel count actually changes, and check
that before reading anything from the next span. When reading stops
there, rebuild the resampler.

That fixes a second bug: a span that changed the sample rate was still
being resampled at the old one. 441 frames at 44.1k then 441 at 22.05k,
converted to 48k, gave 962 samples instead of 1440.

Drop the counter the boundary detection was using — reading stops at
the change itself now, so there's nothing left to count. Only the
passthrough still needs it.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@phayes

phayes commented Aug 6, 2026

Copy link
Copy Markdown
Author

This was opened in error. Please see #915 for this fix.

@phayes phayes closed this Aug 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants