Commit b2627d63 by tonihei Committed by Oliver Woodman

Allow ExoPlayerTestRunner to end when Player.stop() is called.

In this case the playback state transitions to IDLE, which isn't
caught so far. (This code is equivalent to the one in ExoHostedTest.java)

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=167980981
parent 7c3fe19d
......@@ -212,6 +212,7 @@ public final class ExoPlayerTestRunner implements Player.EventListener {
private Exception exception;
private TrackGroupArray trackGroups;
private int positionDiscontinuityCount;
private boolean playerWasPrepared;
private ExoPlayerTestRunner(PlayerFactory playerFactory, MediaSource mediaSource,
RenderersFactory renderersFactory, MappingTrackSelector trackSelector,
......@@ -350,7 +351,9 @@ public final class ExoPlayerTestRunner implements Player.EventListener {
if (periodIndices.isEmpty() && playbackState == Player.STATE_READY) {
periodIndices.add(player.getCurrentPeriodIndex());
}
if (playbackState == Player.STATE_ENDED) {
playerWasPrepared |= playbackState != Player.STATE_IDLE;
if (playbackState == Player.STATE_ENDED
|| (playbackState == Player.STATE_IDLE && playerWasPrepared)) {
endedCountDownLatch.countDown();
}
}
......
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