mirror of
https://github.com/samsonjs/media.git
synced 2026-04-14 12:45:47 +00:00
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
This commit is contained in:
parent
ba0e5246d6
commit
84f4fe5cf9
1 changed files with 2 additions and 2 deletions
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue