Commit e883b7c2 by andrewlewis Committed by Oliver Woodman

Clear the timeline on seeking if renderers are reading ahead.

If a renderer is reading ahead of the playing period, seeking within the
playing period would fail, because renderers would not be disabled but then try
to read from SampleStreams that have a released period.

Also, in the same circumstances, seeking within the reading period would fail,
because all renderers would be disabled, but their sample streams have already
been read. When they are reenabled they expect to see a format but don't
receive one.

In both cases, seeking can just clear the timeline. This only occurs in rare
circumstances when the player is reading ahead, so the cost of re-preparing
will not be incurred often, and allows the seeking logic to be simpler.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=129891060
parent 932574a3
......@@ -556,8 +556,11 @@ import java.util.ArrayList;
rebuffering = false;
setState(ExoPlayer.STATE_BUFFERING);
if (positionUs == C.UNSET_TIME_US) {
// We don't know where to seek to yet, so clear the whole timeline.
if (positionUs == C.UNSET_TIME_US
|| (readingPeriod != playingPeriod && (periodIndex == playingPeriod.index
|| (readingPeriod != null && periodIndex == readingPeriod.index)))) {
// Clear the timeline because either the seek position is not known, or a renderer is reading
// ahead to the next period and the seek is to either the playing or reading period.
periodIndex = Timeline.NO_PERIOD_INDEX;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment