Commit 84f4fe5c by tonihei Committed by Oliver Woodman

Recover from empty timelines.

(Related to GitHub #1706)

When the timeline becomes empty, the playback state transitions to "ended".
When the timeline becomes non-empty again, exceptions are thrown because MSG_DO_SOME_WORK is still regularly sent and media periods are getting prepared.

This change ensures that no MSG_DO_SOME_WORK messages are sent in "ended" state.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=160537147
parent ba0e5246
......@@ -618,7 +618,7 @@ import java.io.IOException;
if ((playWhenReady && state == ExoPlayer.STATE_READY) || state == ExoPlayer.STATE_BUFFERING) {
scheduleNextWork(operationStartTimeMs, RENDERING_INTERVAL_MS);
} else if (enabledRenderers.length != 0) {
} else if (enabledRenderers.length != 0 && state != ExoPlayer.STATE_ENDED) {
scheduleNextWork(operationStartTimeMs, IDLE_INTERVAL_MS);
} else {
handler.removeMessages(MSG_DO_SOME_WORK);
......@@ -831,7 +831,7 @@ import java.io.IOException;
for (ExoPlayerMessage message : messages) {
message.target.handleMessage(message.messageType, message.message);
}
if (mediaSource != null) {
if (state == ExoPlayer.STATE_READY || state == ExoPlayer.STATE_BUFFERING) {
// The message may have caused something to change that now requires us to do work.
handler.sendEmptyMessage(MSG_DO_SOME_WORK);
}
......
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