mirror of
https://github.com/androidx/media.git
synced 2025-05-04 22:20:47 +08:00
Do not start rebuffering after playback ended.
This is currently happening after toggling the repeat mode. This is line with the rest of the implementation which requires a seek operation to resume playback. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=160516449
This commit is contained in:
parent
1f815db367
commit
a98d5bbd0a
@ -226,22 +226,22 @@ public final class ExoPlayerTest extends TestCase {
|
||||
final int[] actionSchedule = { // 0 -> 1
|
||||
ExoPlayer.REPEAT_MODE_ONE, // 1 -> 1
|
||||
ExoPlayer.REPEAT_MODE_OFF, // 1 -> 2
|
||||
-1, // 2 -> ended
|
||||
ExoPlayer.REPEAT_MODE_ONE, // ended -> 2
|
||||
ExoPlayer.REPEAT_MODE_ONE, // 2 -> 2
|
||||
ExoPlayer.REPEAT_MODE_ALL, // 2 -> 0
|
||||
ExoPlayer.REPEAT_MODE_ONE, // 0 -> 0
|
||||
-1, // 0 -> 0
|
||||
ExoPlayer.REPEAT_MODE_OFF, // 0 -> 1
|
||||
-1, // 1 -> 2
|
||||
-1, // 2 -> ended
|
||||
-1
|
||||
-1 // 2 -> ended
|
||||
};
|
||||
int[] expectedWindowIndices = {1, 1, 2, 2, 2, 0, 0, 0, 1, 2, 2};
|
||||
int[] expectedWindowIndices = {1, 1, 2, 2, 0, 0, 0, 1, 2};
|
||||
final LinkedList<Integer> windowIndices = new LinkedList<>();
|
||||
final CountDownLatch actionCounter = new CountDownLatch(actionSchedule.length);
|
||||
PlayerWrapper playerWrapper = new PlayerWrapper() {
|
||||
@Override
|
||||
@SuppressWarnings("ResourceType")
|
||||
private void executeAction() {
|
||||
public void onPositionDiscontinuity() {
|
||||
super.onPositionDiscontinuity();
|
||||
int actionIndex = actionSchedule.length - (int) actionCounter.getCount();
|
||||
if (actionSchedule[actionIndex] != -1) {
|
||||
player.setRepeatMode(actionSchedule[actionIndex]);
|
||||
@ -249,20 +249,6 @@ public final class ExoPlayerTest extends TestCase {
|
||||
windowIndices.add(player.getCurrentWindowIndex());
|
||||
actionCounter.countDown();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPlayerStateChanged(boolean playWhenReady, int playbackState) {
|
||||
super.onPlayerStateChanged(playWhenReady, playbackState);
|
||||
if (playbackState == ExoPlayer.STATE_ENDED) {
|
||||
executeAction();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPositionDiscontinuity() {
|
||||
super.onPositionDiscontinuity();
|
||||
executeAction();
|
||||
}
|
||||
};
|
||||
MediaSource mediaSource = new FakeMediaSource(timeline, null, TEST_VIDEO_FORMAT);
|
||||
FakeRenderer renderer = new FakeRenderer(TEST_VIDEO_FORMAT);
|
||||
|
@ -488,11 +488,6 @@ import java.io.IOException;
|
||||
long newPositionUs = seekToPeriodPosition(periodId, playbackInfo.positionUs);
|
||||
playbackInfo = new PlaybackInfo(periodId, newPositionUs);
|
||||
}
|
||||
|
||||
// Restart buffering if playback has ended and repetition is enabled.
|
||||
if (state == ExoPlayer.STATE_ENDED && repeatMode != ExoPlayer.REPEAT_MODE_OFF) {
|
||||
setState(ExoPlayer.STATE_BUFFERING);
|
||||
}
|
||||
}
|
||||
|
||||
private void startRenderers() throws ExoPlaybackException {
|
||||
|
Loading…
x
Reference in New Issue
Block a user