Bug 1299064. Part 1 - move |SetState(nextState)| and ScheduleStateMachine() to the bottom of SeekCompleted().
UpdatePlaybackPositionInternal(), |mQuickBuffering = false| and |mMediaSink->Redraw| should belong to
the exit action of SEEKING. By change the order of the statements, we have a better definition/scope
for the jobs of each state.
MozReview-Commit-ID: 6WESdwaD8Ba
--- a/dom/media/MediaDecoderStateMachine.cpp
+++ b/dom/media/MediaDecoderStateMachine.cpp
@@ -2176,39 +2176,39 @@ MediaDecoderStateMachine::SeekCompleted(
// data requests.
if (mDecodingFirstFrame) {
// We were resuming from dormant, or initiated a seek early.
// We can fire loadeddata now.
FinishDecodeFirstFrame();
}
- if (nextState == DECODER_STATE_DECODING) {
- SetState(DECODER_STATE_DECODING);
- } else {
- SetState(nextState);
- }
-
// Ensure timestamps are up to date.
UpdatePlaybackPositionInternal(newCurrentTime);
// Try to decode another frame to detect if we're at the end...
DECODER_LOG("Seek completed, mCurrentPosition=%lld", mCurrentPosition.Ref());
// Reset quick buffering status. This ensures that if we began the
// seek while quick-buffering, we won't bypass quick buffering mode
// if we need to buffer after the seek.
mQuickBuffering = false;
- ScheduleStateMachine();
-
if (video) {
mMediaSink->Redraw(mInfo.mVideo);
mOnPlaybackEvent.Notify(MediaEventType::Invalidate);
}
+
+ if (nextState == DECODER_STATE_DECODING) {
+ SetState(DECODER_STATE_DECODING);
+ } else {
+ SetState(nextState);
+ }
+
+ ScheduleStateMachine();
}
RefPtr<ShutdownPromise>
MediaDecoderStateMachine::BeginShutdown()
{
return InvokeAsync(OwnerThread(), this, __func__,
&MediaDecoderStateMachine::Shutdown);
}