Commit a98d5bbd by tonihei Committed by Oliver Woodman

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
parent 1f815db3
...@@ -226,22 +226,22 @@ public final class ExoPlayerTest extends TestCase { ...@@ -226,22 +226,22 @@ public final class ExoPlayerTest extends TestCase {
final int[] actionSchedule = { // 0 -> 1 final int[] actionSchedule = { // 0 -> 1
ExoPlayer.REPEAT_MODE_ONE, // 1 -> 1 ExoPlayer.REPEAT_MODE_ONE, // 1 -> 1
ExoPlayer.REPEAT_MODE_OFF, // 1 -> 2 ExoPlayer.REPEAT_MODE_OFF, // 1 -> 2
-1, // 2 -> ended ExoPlayer.REPEAT_MODE_ONE, // 2 -> 2
ExoPlayer.REPEAT_MODE_ONE, // ended -> 2
ExoPlayer.REPEAT_MODE_ALL, // 2 -> 0 ExoPlayer.REPEAT_MODE_ALL, // 2 -> 0
ExoPlayer.REPEAT_MODE_ONE, // 0 -> 0 ExoPlayer.REPEAT_MODE_ONE, // 0 -> 0
-1, // 0 -> 0 -1, // 0 -> 0
ExoPlayer.REPEAT_MODE_OFF, // 0 -> 1 ExoPlayer.REPEAT_MODE_OFF, // 0 -> 1
-1, // 1 -> 2 -1, // 1 -> 2
-1, // 2 -> ended -1 // 2 -> ended
-1
}; };
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 LinkedList<Integer> windowIndices = new LinkedList<>();
final CountDownLatch actionCounter = new CountDownLatch(actionSchedule.length); final CountDownLatch actionCounter = new CountDownLatch(actionSchedule.length);
PlayerWrapper playerWrapper = new PlayerWrapper() { PlayerWrapper playerWrapper = new PlayerWrapper() {
@Override
@SuppressWarnings("ResourceType") @SuppressWarnings("ResourceType")
private void executeAction() { public void onPositionDiscontinuity() {
super.onPositionDiscontinuity();
int actionIndex = actionSchedule.length - (int) actionCounter.getCount(); int actionIndex = actionSchedule.length - (int) actionCounter.getCount();
if (actionSchedule[actionIndex] != -1) { if (actionSchedule[actionIndex] != -1) {
player.setRepeatMode(actionSchedule[actionIndex]); player.setRepeatMode(actionSchedule[actionIndex]);
...@@ -249,20 +249,6 @@ public final class ExoPlayerTest extends TestCase { ...@@ -249,20 +249,6 @@ public final class ExoPlayerTest extends TestCase {
windowIndices.add(player.getCurrentWindowIndex()); windowIndices.add(player.getCurrentWindowIndex());
actionCounter.countDown(); 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); MediaSource mediaSource = new FakeMediaSource(timeline, null, TEST_VIDEO_FORMAT);
FakeRenderer renderer = new FakeRenderer(TEST_VIDEO_FORMAT); FakeRenderer renderer = new FakeRenderer(TEST_VIDEO_FORMAT);
......
...@@ -488,11 +488,6 @@ import java.io.IOException; ...@@ -488,11 +488,6 @@ import java.io.IOException;
long newPositionUs = seekToPeriodPosition(periodId, playbackInfo.positionUs); long newPositionUs = seekToPeriodPosition(periodId, playbackInfo.positionUs);
playbackInfo = new PlaybackInfo(periodId, newPositionUs); 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 { private void startRenderers() throws ExoPlaybackException {
......
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