rodio icon indicating copy to clipboard operation
rodio copied to clipboard

SourcesQueueOutput can peek metadata from next source

Open 0----0 opened this issue 2 months ago • 0 comments

Fixes #811

SourcesQueueOutput currently violates the span interface by returning incorrect values for sample_rate and channels while the iterator is positioned on a source boundary (i.e. at the end of one source, before the next source has started.).

This PR adjusts its sample_rate and channels implementations so that they use current_span_len == 0 as an admissible heuristic to check if the current source is empty. This means that it can obey the span interface contract as long as the sources are returning Some current_span_len values. (If they aren't, there's probably no way we can possibly obey that contract.)

In order to actually uncomment the basic test for the queue, I also had to adjust the SamplesBuffer implementation to return a Some current_span_len value. This showed some unrelated rounding errors in SkipDuration, so I made unrelated adjustments to the SkipDuration math to reduce rounding errors, just to keep tests passing.

0----0 avatar Nov 07 '25 20:11 0----0