Bug 1308147. Part 1 - add WaitForCDMState::mPendingSeek to store a pending seek job. r=kikuo
authorJW Wang <jwwang@mozilla.com>
Tue, 18 Oct 2016 17:36:49 +0800
changeset 319085 03952d7927577081fa9d10ccf9d4117afd101b13
parent 319084 8a39edd6beb73a5047ca318962d7e28badf63b07
child 319086 736157befbd0d732db5e3994d1c9b1f06cad7ec5
push id30861
push usercbook@mozilla.com
push dateMon, 24 Oct 2016 14:54:01 +0000
treeherdermozilla-central@08efaee1d568 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskikuo
bugs1308147
milestone52.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 1308147. Part 1 - add WaitForCDMState::mPendingSeek to store a pending seek job. r=kikuo MozReview-Commit-ID: LmSSm98k9Ze
dom/media/MediaDecoderStateMachine.cpp
--- a/dom/media/MediaDecoderStateMachine.cpp
+++ b/dom/media/MediaDecoderStateMachine.cpp
@@ -366,49 +366,61 @@ class MediaDecoderStateMachine::WaitForC
   : public MediaDecoderStateMachine::StateObject
 {
 public:
   explicit WaitForCDMState(Master* aPtr) : StateObject(aPtr) {}
 
   void Enter(bool aPendingDormant)
   {
     MOZ_ASSERT(!mMaster->mVideoDecodeSuspended);
+
+    // WAIT_FOR_CDM is transitioned from DECODING_METADATA
+    // where mQueuedSeek must be empty.
+    MOZ_ASSERT(!mMaster->mQueuedSeek.Exists());
+
     mPendingDormant = aPendingDormant;
   }
 
+  void Exit() override
+  {
+    // Transfer the seek job so it is available to the next state.
+    mMaster->mQueuedSeek = Move(mPendingSeek);
+  }
+
   State GetState() const override
   {
     return DECODER_STATE_WAIT_FOR_CDM;
   }
 
   bool HandleDormant(bool aDormant) override;
 
   bool HandleCDMProxyReady() override;
 
   RefPtr<MediaDecoder::SeekPromise> HandleSeek(SeekTarget aTarget) override
   {
     SLOG("Not Enough Data to seek at this stage, queuing seek");
-    mMaster->mQueuedSeek.RejectIfExists(__func__);
-    mMaster->mQueuedSeek.mTarget = aTarget;
-    return mMaster->mQueuedSeek.mPromise.Ensure(__func__);
+    mPendingSeek.RejectIfExists(__func__);
+    mPendingSeek.mTarget = aTarget;
+    return mPendingSeek.mPromise.Ensure(__func__);
   }
 
   void HandleVideoSuspendTimeout() override
   {
     // Do nothing since no decoders are created yet.
   }
 
   void HandleResumeVideoDecoding() override
   {
     // We never suspend video decoding in this state.
     MOZ_ASSERT(false, "Shouldn't have suspended video decoding.");
   }
 
 private:
   bool mPendingDormant = false;
+  SeekJob mPendingSeek;
 };
 
 /**
  * Purpose: release decoder resources to save memory and hardware resources.
  *
  * Transition to:
  *   DECODING_FIRSTFRAME when being asked to exit dormant.
  */