Commit db215ff1 by olly Committed by Oliver Woodman

Make invalid seek positions fail on playback thread only

Seeks are permitted when there's no timeline, and in this
case playback necessarily fails on the playback thread when
the timeline becomes known. Pushing failure to the same
place when the timeline is known means there's only one
failure path for this case. A later CL will likely introduce
an InvalidSeekPositionException for this case.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=141037708
parent 88fc682d
......@@ -179,9 +179,6 @@ import java.util.concurrent.CopyOnWriteArraySet;
@Override
public void seekTo(int windowIndex, long positionMs) {
if (windowIndex < 0 || (!timeline.isEmpty() && windowIndex >= timeline.getWindowCount())) {
throw new IndexOutOfBoundsException();
}
pendingSeekAcks++;
maskingWindowIndex = windowIndex;
if (positionMs == C.TIME_UNSET) {
......
......@@ -987,7 +987,6 @@ import java.io.IOException;
// The application performed a blind seek without a non-empty timeline (most likely based on
// knowledge of what the future timeline will be). Use the internal timeline.
seekTimeline = timeline;
Assertions.checkIndex(seekPosition.windowIndex, 0, timeline.getWindowCount());
}
// Map the SeekPosition to a position in the corresponding timeline.
Pair<Integer, Long> periodPosition = getPeriodPosition(seekTimeline, seekPosition.windowIndex,
......@@ -1044,6 +1043,7 @@ import java.io.IOException;
*/
private Pair<Integer, Long> getPeriodPosition(Timeline timeline, int windowIndex,
long windowPositionUs, long defaultPositionProjectionUs) {
Assertions.checkIndex(windowIndex, 0, timeline.getWindowCount());
timeline.getWindow(windowIndex, window, false, defaultPositionProjectionUs);
if (windowPositionUs == C.TIME_UNSET) {
windowPositionUs = window.getDefaultPositionUs();
......
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