Don't do work after track selection when in ended state

This causes the player to report that it's started loading
when in the ended state.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=176371892
This commit is contained in:
olly 2017-11-20 09:35:01 -08:00 committed by Oliver Woodman
parent 275292cb63
commit 13b595ed39

View file

@ -878,7 +878,7 @@ import java.io.IOException;
boolean[] streamResetFlags = new boolean[renderers.length]; boolean[] streamResetFlags = new boolean[renderers.length];
long periodPositionUs = playingPeriodHolder.updatePeriodTrackSelection( long periodPositionUs = playingPeriodHolder.updatePeriodTrackSelection(
playbackInfo.positionUs, recreateStreams, streamResetFlags); playbackInfo.positionUs, recreateStreams, streamResetFlags);
if (periodPositionUs != playbackInfo.positionUs) { if (state != Player.STATE_ENDED && periodPositionUs != playbackInfo.positionUs) {
playbackInfo = playbackInfo.fromNewPosition(playbackInfo.periodId, periodPositionUs, playbackInfo = playbackInfo.fromNewPosition(playbackInfo.periodId, periodPositionUs,
playbackInfo.contentPositionUs); playbackInfo.contentPositionUs);
eventHandler.obtainMessage(MSG_POSITION_DISCONTINUITY, Player.DISCONTINUITY_REASON_INTERNAL, eventHandler.obtainMessage(MSG_POSITION_DISCONTINUITY, Player.DISCONTINUITY_REASON_INTERNAL,
@ -923,9 +923,11 @@ import java.io.IOException;
loadingPeriodHolder.updatePeriodTrackSelection(loadingPeriodPositionUs, false); loadingPeriodHolder.updatePeriodTrackSelection(loadingPeriodPositionUs, false);
} }
} }
maybeContinueLoading(); if (state != Player.STATE_ENDED) {
updatePlaybackPositions(); maybeContinueLoading();
handler.sendEmptyMessage(MSG_DO_SOME_WORK); updatePlaybackPositions();
handler.sendEmptyMessage(MSG_DO_SOME_WORK);
}
} }
private boolean isTimelineReady(long playingPeriodDurationUs) { private boolean isTimelineReady(long playingPeriodDurationUs) {