fix: keep a seek near the end of the source and the position after seeking back - #328
Merged
Merged
Conversation
…eking back A seek made while the decode thread waited for the queue to play out, which is the last second or two of any source and all of a short one, was taken for the end of the source: the seek emptied the queue, the wait saw it drained, and the player reported the end of the stream and stopped, with the seek still pending. The wait now ends when a seek is pending, and the player carries the seek out instead of ending. Audio only ever moves the position forward, so a position left over from before a seek backwards held an audio-only source at where it had been until the audio caught up. Flushing the pacer now sets the position, and a seek passes its target. The tests fail without the fixes: a seek to the start at 0.7 s of a two second clip played no more frames, and 0.4 s after seeking an audio file back from 1.5 s the position still read 1.5 s.
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.
Summary
MediaPacer::Flushnow takes the position to start from, and a seek passes its target (plus the loop offset, sogetPositionUs()reads the target at once while looping).Test plan
seekNearTheEndIsNotLostandpositionFollowsABackwardSeekOfAudiofail on the old native code (11 frames and none after the seek; position still 1500000 us) and pass with the fix-Dwebrtc.test.hardwareDecoding=true: 56 tests, 0 failures