This repository has been archived by the owner on Jan 12, 2019. It is now read-only.
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.
Description
Sometimes when seeking, buffer time can be really long and the player will load all segments between the the seek points. There are a few cases that cause this behavior.
First being the synchronous call to
fillBuffer_()
inabort()
to avoid waiting for the check buffer timer. This makes aborting and reseting the loader order dependent. WhenfillBuffer_
is called before the reset happens, it miscalculates the segment it should fetch. The eventual goal is to make any synchronousfillBuffer_
calls to become asynchronous with a very short delay so state modifiers such as abort and reset are not order dependent. For now this PR just uses a quick fix of swapping the order of these two calls.The other case is that
abort()
only aborts the segment when the loader is in theWAITING
state. However, both theDECRYPTING
andAPPENDING
states happen asynchronously. SincehandleUpdateEnd_()
changes the loader'smediaIndex
andfillAtBuffer_
states, if the timing is right and a seek happens in one of these two states happens, the loader will reset and resync, but won't cancel the segment since the state is notWAITING
. This means that when the asynchronous process of decrypting or appending finishes and we reachhandleUpdateEnd_
,mediaIndex
andfillAtBuffer_
get updated with an outdated segment, causing confusion forcheckBuffer_
. If we clearpendingSegment_
on an abort while not in theWAITING
state, and check fornull
anywhere we accesspendingSegment_
we can avoid using outdated segment information.Specific Changes proposed
abort()
andresetEverything()
so loader state is correct before fetching more segments.pendingSegment_
on an abort if it exists and the loader is not in theWAITING
state.Requirements Checklist