Repository navigation
fix: make media player seeking, position and queue memory reliable - #537
Merged
Merged
Conversation
A seek went to the container's clock as it was, while the decoders gave out its times unchanged, so a source that does not start at zero sought to the wrong place and could not be looped or played again. Positions now count from the first frame played, video or audio, and a seek before the video starts keeps the audio that comes first.
The seek emptied the queues to free the decode thread, but a decoder with more on its way than a queue takes filled them again, and with playback paused nothing made room, so the thread never got to the seek. Each seek now starts a generation of the pacer, which turns away what is pushed for the one before.
Sixty pictures take over 700 MiB in 4K. The queue is now held to 256 MiB as well, which leaves 1080p its sixty pictures, and a player reports what its queue takes and has taken, so that this can be measured across players running side by side.
Video set the position outright, so a frame delivered late took it back behind audio already played. Delivery now only moves it forward. Items also carry the loop offset of their pass, as the player's own is ahead of playback by the whole queue: looping held the position at zero for most of a short source, and now restarts it as the next pass reaches delivery.
The clock mapping came from whatever reached the pacer first, which on a decoder with many threads was audio starting after the video: the first pictures were overdue by then, and WebRTC dropped all but the last. The mapping now starts at the position when audio gets there first.
Matroska gives where a file ends on its clock, which libavformat passes on as the duration. With positions counting from the first frame, that was too long for a slider and left a gap of the start time at each seam of a loop.
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.
Positions now count from the first frame played, video or audio, so sources that do not start at zero seek, loop and replay correctly. This changes
seekandgetPositionUsfor such sources.getMaxQueuedVideoBytes,getQueuedVideoBytesandgetPeakQueuedVideoBytesmake this measurable across players.