-
Notifications
You must be signed in to change notification settings - Fork 292
fix: span inconsistencies #829
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
+1,091
−707
Conversation
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
* Use VecDeque for output buffering and avoid O(n) remove(0) operations. * Replace Mutex+Atomic pending list with a channel and consume via try_recv. * Drain/retain_mut sources in-place to reduce allocations and copies.
Replace the Vec used for next_sounds with VecDeque to avoid O(n) shifts when removing from the front.
Clarify Source::current_span_len() returns total span length (not remaining), while size_hint() returns remaining samples. Fix multiple bugs in span boundary detection, seeking, and iterator implementations. Opportunistic fixes: - fix division by zero, off-by-one error, and zero case handling - prevent counter overflows - optimize vector allocations Mid-span seeking: best-effort tracking after try_seek() to detect span boundaries when seeking lands mid-span. Fixes #691
7be9aa4 to
39d60f4
Compare
Member
Author
|
GitHub commit log is broken after squashing: opened a new PR. |
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.
Continuing from discussion at #828.
Changes:
current_span_lenconsistently returns total samples in the current spansize_hintreturns the remaining samples, if knownExactSizeIteratoris implemented where the inner source has a fixed lengthtry_seektakes into account mid-span seeks where necessaryI did not fix up the decoders, as I had already done so under the infamous #786.