Add more test cases to the seek test

This test also changes the image seeking behavior to match ExoPlayer: now if
seeking to after the end of the image, the last frame of the image would still
be presented.

PiperOrigin-RevId: 724054371
This commit is contained in:
claincly 2025-02-06 13:29:42 -08:00 committed by Copybara-Service
parent d641f6a04c
commit d23d4fc314
2 changed files with 483 additions and 285 deletions

View File

@ -472,7 +472,6 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
MediaSource.MediaPeriodId mediaPeriodId) MediaSource.MediaPeriodId mediaPeriodId)
throws ExoPlaybackException { throws ExoPlaybackException {
checkState(getTimeline().getWindowCount() == 1); checkState(getTimeline().getWindowCount() == 1);
super.onStreamChanged(formats, startPositionUs, offsetUs, mediaPeriodId);
streamStartPositionUs = startPositionUs; streamStartPositionUs = startPositionUs;
// The media item might have been repeated in the sequence. // The media item might have been repeated in the sequence.
int mediaItemIndex = getTimeline().getIndexOfPeriod(mediaPeriodId.periodUid); int mediaItemIndex = getTimeline().getIndexOfPeriod(mediaPeriodId.periodUid);
@ -481,6 +480,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
timestampIterator = createTimestampIterator(/* positionUs= */ startPositionUs); timestampIterator = createTimestampIterator(/* positionUs= */ startPositionUs);
videoEffects = currentEditedMediaItem.effects.videoEffects; videoEffects = currentEditedMediaItem.effects.videoEffects;
inputStreamPending = true; inputStreamPending = true;
super.onStreamChanged(formats, startPositionUs, offsetUs, mediaPeriodId);
} }
@Override @Override