mirror of
https://github.com/androidx/media.git
synced 2025-05-08 08:00:49 +08:00
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
This commit is contained in:
parent
7c3fe19d3f
commit
b2627d63fd
@ -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();
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user