Bug 1314884. Part 2 - Let DORMANT transition to SEEKING when play state changes to PLAYING since we need to seek anyway whenever exiting dormant. draft
authorJW Wang <jwwang@mozilla.com>
Thu, 03 Nov 2016 15:02:22 +0800
changeset 434660 702fdef0b3da6f1a01f26397f4e6364f495966db
parent 434659 4ced360b44ec42404fa2d7d8da3952372affef38
child 434661 a2d397d3037c8ac81df32e906bd73578f7b2dac7
push id34784
push userjwwang@mozilla.com
push dateMon, 07 Nov 2016 03:12:00 +0000
bugs1314884
milestone52.0a1
Bug 1314884. Part 2 - Let DORMANT transition to SEEKING when play state changes to PLAYING since we need to seek anyway whenever exiting dormant. MozReview-Commit-ID: 9d7Gea1iclh
dom/media/MediaDecoderStateMachine.cpp
--- a/dom/media/MediaDecoderStateMachine.cpp
+++ b/dom/media/MediaDecoderStateMachine.cpp
@@ -389,18 +389,17 @@ public:
 private:
   SeekJob mPendingSeek;
 };
 
 /**
  * Purpose: release decoder resources to save memory and hardware resources.
  *
  * Transition to:
- *   DECODING_FIRSTFRAME when play state changes to PLAYING.
- *   SEEKING if any seek request.
+ *   SEEKING if any seek request or play state changes to PLAYING.
  */
 class MediaDecoderStateMachine::DormantState
   : public MediaDecoderStateMachine::StateObject
 {
 public:
   explicit DormantState(Master* aPtr) : StateObject(aPtr) {}
 
   void Enter()
@@ -1290,17 +1289,18 @@ DormantState::HandleSeek(SeekTarget aTar
 
 void
 MediaDecoderStateMachine::
 DormantState::HandlePlayStateChanged(MediaDecoder::PlayState aPlayState)
 {
   if (aPlayState == MediaDecoder::PLAY_STATE_PLAYING) {
     // Exit dormant when the user wants to play.
     MOZ_ASSERT(!Info().IsEncrypted() || mMaster->mCDMProxy);
-    SetState<DecodingFirstFrameState>(Move(mPendingSeek));
+    MOZ_ASSERT(mMaster->mSentFirstFrameLoadedEvent);
+    SetState<SeekingState>(Move(mPendingSeek));
   }
 }
 
 void
 MediaDecoderStateMachine::
 WaitForCDMState::HandleCDMProxyReady()
 {
   SetState<DecodingFirstFrameState>(Move(mPendingSeek));