Bug 1319706. Part 2 - remove the SeekJob parameter from DecodingFirstFrameState::Enter(). r=kaku
authorJW Wang <jwwang@mozilla.com>
Wed, 23 Nov 2016 17:56:12 +0800
changeset 324618 03144421b4a60da0fa4cbaf0548252bb2af3dc5a
parent 324617 8aaa89d73c3fe8540a6b6d20693a9447951690e9
child 324619 3dc995228de419ee09061b826f21e0ad547abc97
push id24
push usermaklebus@msu.edu
push dateTue, 20 Dec 2016 03:11:33 +0000
reviewerskaku
bugs1319706
milestone53.0a1
Bug 1319706. Part 2 - remove the SeekJob parameter from DecodingFirstFrameState::Enter(). r=kaku MozReview-Commit-ID: ACea0NLMRLn
dom/media/MediaDecoderStateMachine.cpp
--- a/dom/media/MediaDecoderStateMachine.cpp
+++ b/dom/media/MediaDecoderStateMachine.cpp
@@ -343,16 +343,17 @@ private:
 
   MozPromiseRequestHolder<MediaDecoderReader::MetadataPromise> mMetadataRequest;
 };
 
 /**
  * Purpose: wait for the CDM to start decoding.
  *
  * Transition to other states when CDM is ready:
+ *   SEEKING if any pending seek request.
  *   DECODING_FIRSTFRAME otherwise.
  */
 class MediaDecoderStateMachine::WaitForCDMState
   : public MediaDecoderStateMachine::StateObject
 {
 public:
   explicit WaitForCDMState(Master* aPtr) : StateObject(aPtr) {}
 
@@ -466,17 +467,17 @@ private:
  *   DECODING when the 'loadeddata' event is fired.
  */
 class MediaDecoderStateMachine::DecodingFirstFrameState
   : public MediaDecoderStateMachine::StateObject
 {
 public:
   explicit DecodingFirstFrameState(Master* aPtr) : StateObject(aPtr) {}
 
-  void Enter(SeekJob aPendingSeek);
+  void Enter();
 
   State GetState() const override
   {
     return DECODER_STATE_DECODING_FIRSTFRAME;
   }
 
   void HandleAudioDecoded(MediaData* aAudio) override
   {
@@ -1266,17 +1267,17 @@ DecodeMetadataState::OnMetadataRead(Meta
 
   mMaster->EnqueueLoadedMetadataEvent();
 
   if (Info().IsEncrypted() && !mMaster->mCDMProxy) {
     // Metadata parsing was successful but we're still waiting for CDM caps
     // to become available so that we can build the correct decryptor/decoder.
     SetState<WaitForCDMState>();
   } else {
-    SetState<DecodingFirstFrameState>(SeekJob{});
+    SetState<DecodingFirstFrameState>();
   }
 }
 
 void
 MediaDecoderStateMachine::
 DormantState::HandlePlayStateChanged(MediaDecoder::PlayState aPlayState)
 {
   if (aPlayState == MediaDecoder::PLAY_STATE_PLAYING) {
@@ -1286,29 +1287,27 @@ DormantState::HandlePlayStateChanged(Med
     SetState<SeekingState>(Move(mPendingSeek), EventVisibility::Suppressed);
   }
 }
 
 void
 MediaDecoderStateMachine::
 WaitForCDMState::HandleCDMProxyReady()
 {
-  SetState<DecodingFirstFrameState>(Move(mPendingSeek));
+  if (mPendingSeek.Exists()) {
+    SetState<SeekingState>(Move(mPendingSeek), EventVisibility::Observable);
+  } else {
+    SetState<DecodingFirstFrameState>();
+  }
 }
 
 void
 MediaDecoderStateMachine::
-DecodingFirstFrameState::Enter(SeekJob aPendingSeek)
+DecodingFirstFrameState::Enter()
 {
-  // Handle pending seek.
-  if (aPendingSeek.Exists()) {
-    SetState<SeekingState>(Move(aPendingSeek), EventVisibility::Observable);
-    return;
-  }
-
   // Transition to DECODING if we've decoded first frames.
   if (mMaster->mSentFirstFrameLoadedEvent) {
     SetState<DecodingState>();
     return;
   }
 
   MOZ_ASSERT(!mMaster->mVideoDecodeSuspended);