Bug 1349097 P1 - don't switch to SEEKING state while resuming video decoder in COMPLETED state; r?jwwang draft
authorKaku Kuo <kaku@mozilla.com>
Fri, 24 Mar 2017 16:39:55 +0800
changeset 504498 87402bc72228b47c5e9154b57d26e69a5c68654a
parent 503306 7513b3f42058e9bcf9950d4acf4647d4ad2240f0
child 504499 d85e0204298bf36880a32ed06e22802e8f6bc412
push id50807
push userbmo:kaku@mozilla.com
push dateFri, 24 Mar 2017 09:15:25 +0000
reviewersjwwang
bugs1349097
milestone55.0a1
Bug 1349097 P1 - don't switch to SEEKING state while resuming video decoder in COMPLETED state; r?jwwang Since the palyback had ended, don't bother to resume decoder and seek, but still need to pass information to reader. MozReview-Commit-ID: YdTpULK3XD
dom/media/MediaDecoderStateMachine.cpp
--- a/dom/media/MediaDecoderStateMachine.cpp
+++ b/dom/media/MediaDecoderStateMachine.cpp
@@ -1876,16 +1876,29 @@ public:
   void HandlePlayStateChanged(MediaDecoder::PlayState aPlayState) override
   {
     if (aPlayState == MediaDecoder::PLAY_STATE_PLAYING) {
       // Schedule Step() to check if we can start playback.
       mMaster->ScheduleStateMachine();
     }
   }
 
+  void HandleResumeVideoDecoding() override
+  {
+    // The playback had ended, and we don't need to "resume" the video decoder
+    // anymore which means we don't need to switch to SEEKING state.
+    // However, we still need to notify the reader that we don't want to suspend
+    // video decoder anymore, so that the reader will create a standard video
+    // decoder next time the playback is restarted again.
+    MOZ_ASSERT(mMaster->mVideoDecodeSuspended);
+    mMaster->mVideoDecodeSuspended = false;
+    mMaster->mOnPlaybackEvent.Notify(MediaEventType::ExitVideoSuspend);
+    Reader()->SetVideoBlankDecode(false);
+  }
+
 private:
   bool mSentPlaybackEndedEvent = false;
 };
 
 /**
  * Purpose: release all resources allocated by MDSM.
  *
  * Transition to: