Remove resumeInternal from ExoPlayerImplInternal.
------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=125670965
This commit is contained in:
parent
291b210be3
commit
8eb1f3f57c
@ -353,14 +353,12 @@ import java.util.ArrayList;
|
|||||||
if (sampleSource == null) {
|
if (sampleSource == null) {
|
||||||
timeline.updateSources();
|
timeline.updateSources();
|
||||||
sampleSource = timeline.getSampleSource();
|
sampleSource = timeline.getSampleSource();
|
||||||
if (sampleSource != null) {
|
if (sampleSource == null) {
|
||||||
resumeInternal();
|
|
||||||
} else {
|
|
||||||
// We're still waiting for the source to be prepared.
|
// We're still waiting for the source to be prepared.
|
||||||
scheduleNextOperation(MSG_DO_SOME_WORK, operationStartTimeMs, PREPARING_SOURCE_INTERVAL_MS);
|
scheduleNextOperation(MSG_DO_SOME_WORK, operationStartTimeMs, PREPARING_SOURCE_INTERVAL_MS);
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
TraceUtil.beginSection("doSomeWork");
|
TraceUtil.beginSection("doSomeWork");
|
||||||
|
|
||||||
@ -439,59 +437,27 @@ import java.util.ArrayList;
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setState(ExoPlayer.STATE_BUFFERING);
|
||||||
|
stopRenderers();
|
||||||
|
rebuffering = false;
|
||||||
|
|
||||||
if (sourceIndex != playbackInfo.sourceIndex) {
|
if (sourceIndex != playbackInfo.sourceIndex) {
|
||||||
playbackInfo = new PlaybackInfo(sourceIndex);
|
playbackInfo = new PlaybackInfo(sourceIndex);
|
||||||
eventHandler.obtainMessage(MSG_SOURCE_CHANGED, playbackInfo).sendToTarget();
|
eventHandler.obtainMessage(MSG_SOURCE_CHANGED, playbackInfo).sendToTarget();
|
||||||
}
|
}
|
||||||
|
|
||||||
rebuffering = false;
|
|
||||||
standaloneMediaClock.stop();
|
|
||||||
|
|
||||||
sampleSource = timeline.seekToSource(sourceIndex);
|
sampleSource = timeline.seekToSource(sourceIndex);
|
||||||
if (sampleSource == null) {
|
if (sampleSource != null && enabledRenderers.length > 0) {
|
||||||
// The source isn't prepared.
|
|
||||||
setNewSourcePositionInternal(seekPositionUs);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (enabledRenderers.length > 0) {
|
|
||||||
for (TrackRenderer renderer : enabledRenderers) {
|
|
||||||
ensureStopped(renderer);
|
|
||||||
}
|
|
||||||
seekPositionUs = sampleSource.seekToUs(seekPositionUs);
|
seekPositionUs = sampleSource.seekToUs(seekPositionUs);
|
||||||
}
|
}
|
||||||
|
|
||||||
setNewSourcePositionInternal(seekPositionUs);
|
setNewSourcePositionInternal(seekPositionUs);
|
||||||
resumeInternal();
|
handler.sendEmptyMessage(MSG_DO_SOME_WORK);
|
||||||
} finally {
|
} finally {
|
||||||
eventHandler.sendEmptyMessage(MSG_SEEK_ACK);
|
eventHandler.sendEmptyMessage(MSG_SEEK_ACK);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void resumeInternal() throws ExoPlaybackException {
|
|
||||||
boolean allRenderersEnded = true;
|
|
||||||
boolean allRenderersReadyOrEnded = true;
|
|
||||||
for (TrackRenderer renderer : enabledRenderers) {
|
|
||||||
allRenderersEnded = allRenderersEnded && renderer.isEnded();
|
|
||||||
allRenderersReadyOrEnded = allRenderersReadyOrEnded && isReadyOrEnded(renderer);
|
|
||||||
}
|
|
||||||
|
|
||||||
updateBufferedPositionUs();
|
|
||||||
if (allRenderersEnded && (playbackInfo.durationUs == C.UNSET_TIME_US
|
|
||||||
|| playbackInfo.durationUs <= playbackInfo.positionUs)) {
|
|
||||||
setState(ExoPlayer.STATE_ENDED);
|
|
||||||
} else {
|
|
||||||
setState(allRenderersReadyOrEnded && haveSufficientBuffer() && timeline.isReady()
|
|
||||||
? ExoPlayer.STATE_READY : ExoPlayer.STATE_BUFFERING);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Start the renderers if ready, and schedule the first piece of work.
|
|
||||||
if (playWhenReady && state == ExoPlayer.STATE_READY) {
|
|
||||||
startRenderers();
|
|
||||||
}
|
|
||||||
handler.sendEmptyMessage(MSG_DO_SOME_WORK);
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean checkForSourceDiscontinuityInternal() throws ExoPlaybackException {
|
private boolean checkForSourceDiscontinuityInternal() throws ExoPlaybackException {
|
||||||
long newSourcePositionUs = sampleSource.readDiscontinuity();
|
long newSourcePositionUs = sampleSource.readDiscontinuity();
|
||||||
if (newSourcePositionUs == C.UNSET_TIME_US) {
|
if (newSourcePositionUs == C.UNSET_TIME_US) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user