Repository navigation
Conversation
SourcesQueueOutput only moved a queued source into current when next() ran out of samples, so try_seek before the first sample hit the Empty placeholder and failed, and try_seek right after a source ended seeked the finished source. Move past exhausted sources first when something is queued, as next() would. Fixes RustAudio#932
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
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.
Fixes #932
What was wrong
SourcesQueueOutputonly moves a queued source intocurrentwhennext()runs out ofsamples. Until then
currentis the initialEmpty(or the source that just finished), sotry_seekwent to the wrong source:append, before the first sample, it failed withNotSupportedfromEmpty;source instead of the one about to play.
The fix
try_seeknow does whatnext()would do first: whilecurrentis exhausted, it moves tothe next queued source (skipping exhausted ones and signalling
append_with_signalreceiversas usual), then seeks it.
channels()andsample_rate()already look ahead the same way.It does nothing while keep-alive silence padding is still completing a frame, so frame
alignment and span lengths are unchanged. When nothing is queued,
currentis left alone, soseeking an empty queue (or one whose last source has finished) behaves exactly as before.
Tests
New tests in
src/queue.rs:seek_before_first_sample(the snippet from the issue, with and without keep-alive)seek_after_source_finished_moves_to_next_sourceseek_skips_exhausted_sourcesseek_on_empty_queue_fails_and_keeps_playing_silenceThe first three fail on master and pass with the fix.
This is a small, local change on purpose, so the engine rewrite can replace it later if the
queue gets reworked there. For reference, none of the open rewrite PRs (#904, #905, #910,
#911) change
src/queue.rs; #911 only touchessrc/player.rsfor the newamplifyAPI.