Bug 1299064. Part 1 - move |SetState(nextState)| and ScheduleStateMachine() to the bottom of SeekCompleted(). r=kaku
authorJW Wang <jwwang@mozilla.com>
Tue, 30 Aug 2016 15:04:43 +0800
changeset 312036 c9f208e04b62783c69c1fd17de962f168b3b4df2
parent 312035 3b37159b1121faa8b9fa49b52e6c8129ac9bca43
child 312037 437650642dd869c0d1bc14fff37d310226b36643
push id30630
push userkwierso@gmail.com
push dateWed, 31 Aug 2016 23:55:04 +0000
treeherdermozilla-central@c18c990a038f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskaku
bugs1299064
milestone51.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1299064. Part 1 - move |SetState(nextState)| and ScheduleStateMachine() to the bottom of SeekCompleted(). r=kaku 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
dom/media/MediaDecoderStateMachine.cpp
--- 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);
 }