Bug 1298217. Part 6 - Move some code to the entry action of DECODER_STATE_COMPLETED.
MozReview-Commit-ID: 5hf3NV5uLvS
--- a/dom/media/MediaDecoderStateMachine.cpp
+++ b/dom/media/MediaDecoderStateMachine.cpp
@@ -711,17 +711,16 @@ MediaDecoderStateMachine::OnNotDecoded(M
switch (mState) {
case DECODER_STATE_BUFFERING:
case DECODER_STATE_DECODING: {
if (MaybeFinishDecodeFirstFrame()) {
return;
}
if (CheckIfDecodeComplete()) {
SetState(DECODER_STATE_COMPLETED);
- ScheduleStateMachine();
return;
}
// Schedule next cycle to see if we can leave buffering state.
if (mState == DECODER_STATE_BUFFERING) {
ScheduleStateMachine();
}
return;
}
@@ -1091,16 +1090,19 @@ MediaDecoderStateMachine::EnterState(Sta
case DECODER_STATE_DORMANT:
DiscardSeekTaskIfExist();
if (IsPlaying()) {
StopPlayback();
}
Reset();
mReader->ReleaseResources();
break;
+ case DECODER_STATE_COMPLETED:
+ ScheduleStateMachine();
+ break;
case DECODER_STATE_ERROR:
case DECODER_STATE_SHUTDOWN:
mIsShutdown = true;
break;
default:
break;
}
}
@@ -1274,17 +1276,16 @@ void MediaDecoderStateMachine::StartDeco
if (mQueuedSeek.Exists()) {
InitiateSeek(Move(mQueuedSeek));
return;
}
}
if (CheckIfDecodeComplete()) {
SetState(DECODER_STATE_COMPLETED);
- ScheduleStateMachine();
return;
}
mDecodeStartTime = TimeStamp::Now();
// Reset other state to pristine values before starting decode.
mIsAudioPrerolling = !DonePrerollingAudio() && !mReader->IsWaitingAudioData();
mIsVideoPrerolling = !DonePrerollingVideo() && !mReader->IsWaitingVideoData();