mirror of
https://github.com/samsonjs/media.git
synced 2026-03-27 09:45:47 +00:00
Fix issue with keeping window sequence number after repeated seeks.
The number is shelved in calls to queue.clear() to keep it for the next media period. However, the queue may also become empty by repeated calls to advancePlayingPeriod which may happen when seeking to an unprepared period. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=205376036
This commit is contained in:
parent
9bb64b7e44
commit
e03623f701
2 changed files with 41 additions and 1 deletions
|
|
@ -228,11 +228,13 @@ import com.google.android.exoplayer2.util.Assertions;
|
|||
reading = playing.next;
|
||||
}
|
||||
playing.release();
|
||||
playing = playing.next;
|
||||
length--;
|
||||
if (length == 0) {
|
||||
loading = null;
|
||||
oldFrontPeriodUid = playing.uid;
|
||||
oldFrontPeriodWindowSequenceNumber = playing.info.id.windowSequenceNumber;
|
||||
}
|
||||
playing = playing.next;
|
||||
} else {
|
||||
playing = loading;
|
||||
reading = loading;
|
||||
|
|
|
|||
|
|
@ -1980,6 +1980,44 @@ public final class ExoPlayerTest {
|
|||
.inOrder();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRepeatedSeeksToUnpreparedPeriodInSameWindowKeepsWindowSequenceNumber()
|
||||
throws Exception {
|
||||
Timeline timeline =
|
||||
new FakeTimeline(
|
||||
new TimelineWindowDefinition(
|
||||
/* periodCount= */ 2,
|
||||
/* id= */ 0,
|
||||
/* isSeekable= */ true,
|
||||
/* isDynamic= */ false,
|
||||
/* durationUs= */ 10 * C.MICROS_PER_SECOND));
|
||||
FakeMediaSource mediaSource = new FakeMediaSource(timeline, /* manifest= */ null);
|
||||
ActionSchedule actionSchedule =
|
||||
new ActionSchedule.Builder("testSeekToUnpreparedPeriod")
|
||||
.pause()
|
||||
.waitForPlaybackState(Player.STATE_READY)
|
||||
.seek(/* windowIndex= */ 0, /* positionMs= */ 9999)
|
||||
.seek(/* windowIndex= */ 0, /* positionMs= */ 1)
|
||||
.seek(/* windowIndex= */ 0, /* positionMs= */ 9999)
|
||||
.play()
|
||||
.build();
|
||||
ExoPlayerTestRunner testRunner =
|
||||
new ExoPlayerTestRunner.Builder()
|
||||
.setMediaSource(mediaSource)
|
||||
.setActionSchedule(actionSchedule)
|
||||
.build()
|
||||
.start()
|
||||
.blockUntilEnded(TIMEOUT_MS);
|
||||
|
||||
testRunner.assertPlayedPeriodIndices(0, 1, 0, 1);
|
||||
assertThat(mediaSource.getCreatedMediaPeriods())
|
||||
.containsAllOf(
|
||||
new MediaPeriodId(/* periodIndex= */ 0, /* windowSequenceNumber= */ 0),
|
||||
new MediaPeriodId(/* periodIndex= */ 1, /* windowSequenceNumber= */ 0));
|
||||
assertThat(mediaSource.getCreatedMediaPeriods())
|
||||
.doesNotContain(new MediaPeriodId(/* periodIndex= */ 1, /* windowSequenceNumber= */ 1));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRecursivePlayerChangesReportConsistentValuesForAllListeners() throws Exception {
|
||||
// We add two listeners to the player. The first stops the player as soon as it's ready and both
|
||||
|
|
|
|||
Loading…
Reference in a new issue