Skip to content

Conversation

@roderickvd
Copy link
Member

Fixes incorrect sample_rate() and channels() metadata returned by SourcesQueueOutput when transitioning between sources with different formats or from an empty queue. This caused audio distortion at boundaries where metadata changes occurred.

Changes:

  • Clarified Source::current_span_len() contract: returns total span size, Some(0) when exhausted
  • Fixed SamplesBuffer to return Some(total_size) or Some(0) when exhausted (was None)
  • Fixed SamplesBuffer::size_hint() to return remaining samples
  • Updated SourcesQueueOutput to peek next source metadata when current is exhausted
  • Added Source::is_exhausted() helper method for cleaner exhaustion checks throughout codebase
  • Implemented ExactSizeIterator for SamplesBuffer
  • Improved SkipDuration precision to avoid rounding errors

This supersedes PR #812 with a cleaner implementation following the proper current_span_len() contract. Enabled previously ignored queue::tests::basic test to prevent regressions.

Fixes #811

Fixes incorrect sample_rate() and channels() metadata returned by
SourcesQueueOutput when transitioning between sources with different
formats or from an empty queue. This caused audio distortion at
boundaries where metadata changes occurred.

Changes:
- Clarified Source::current_span_len() contract: returns total span
  size, Some(0) when exhausted
- Fixed SamplesBuffer to return Some(total_size) or Some(0) when
  exhausted (was None)
- Fixed SamplesBuffer::size_hint() to return remaining samples
- Updated SourcesQueueOutput to peek next source metadata when current
  is exhausted
- Added Source::is_exhausted() helper method for cleaner exhaustion
  checks throughout codebase
- Implemented ExactSizeIterator for SamplesBuffer
- Improved SkipDuration precision to avoid rounding errors

This supersedes PR #812 with a cleaner implementation following the
proper current_span_len() contract. Enabled previously ignored
queue::tests::basic test to prevent regressions.

Fixes #811

Co-authored-by: 0----0 <9070490+0----0@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

First 512 samples of a source added to an empty Sink are always mono

2 participants