Bug 1300956. Part 4 - Implement DecodingFirstFrameState. r=kaku
authorJW Wang <jwwang@mozilla.com>
Tue, 06 Sep 2016 11:10:52 +0800
changeset 313187 30b53fa5af1379222391b9dfdcd0bf290adb0cbc
parent 313186 174da142669cd40e4c4f7cb15ef7c538ce8541af
child 313188 b9ea5ce506a7318e037aa519a8af63aa307f8ab6
push id30674
push userkwierso@gmail.com
push dateThu, 08 Sep 2016 22:03:48 +0000
treeherdermozilla-central@5d854c8d0765 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskaku
bugs1300956
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 1300956. Part 4 - Implement DecodingFirstFrameState. r=kaku MozReview-Commit-ID: DXMv6pGbo7N
dom/media/MediaDecoderStateMachine.cpp
--- a/dom/media/MediaDecoderStateMachine.cpp
+++ b/dom/media/MediaDecoderStateMachine.cpp
@@ -268,16 +268,33 @@ public:
   }
 
   State GetState() const override
   {
     return DECODER_STATE_DORMANT;
   }
 };
 
+class MediaDecoderStateMachine::DecodingFirstFrameState
+  : public MediaDecoderStateMachine::StateObject
+{
+public:
+  explicit DecodingFirstFrameState(Master* aPtr) : StateObject(aPtr) {}
+
+  void Enter() override
+  {
+    mMaster->DecodeFirstFrame();
+  }
+
+  State GetState() const override
+  {
+    return DECODER_STATE_DECODING_FIRSTFRAME;
+  }
+};
+
 #define INIT_WATCHABLE(name, val) \
   name(val, "MediaDecoderStateMachine::" #name)
 #define INIT_MIRROR(name, val) \
   name(mTaskQueue, val, "MediaDecoderStateMachine::" #name " (Mirror)")
 #define INIT_CANONICAL(name, val) \
   name(mTaskQueue, val, "MediaDecoderStateMachine::" #name " (Canonical)")
 
 MediaDecoderStateMachine::MediaDecoderStateMachine(MediaDecoder* aDecoder,
@@ -1141,16 +1158,19 @@ MediaDecoderStateMachine::SetState(State
       mStateObj = MakeUnique<DecodeMetadataState>(this);
       break;
     case DECODER_STATE_WAIT_FOR_CDM:
       mStateObj = MakeUnique<WaitForCDMState>(this);
       break;
     case DECODER_STATE_DORMANT:
       mStateObj = MakeUnique<DormantState>(this);
       break;
+    case DECODER_STATE_DECODING_FIRSTFRAME:
+      mStateObj = MakeUnique<DecodingFirstFrameState>(this);
+      break;
     default:
       mStateObj = nullptr;
       break;
   }
 
   EnterState();
 }
 
@@ -1184,19 +1204,16 @@ MediaDecoderStateMachine::EnterState()
 
   if (mStateObj) {
     MOZ_ASSERT(mState == mStateObj->GetState());
     mStateObj->Enter();
     return;
   }
 
   switch (mState) {
-    case DECODER_STATE_DECODING_FIRSTFRAME:
-      DecodeFirstFrame();
-      break;
     case DECODER_STATE_DECODING:
       StartDecoding();
       break;
     case DECODER_STATE_BUFFERING:
       StartBuffering();
       break;
     case DECODER_STATE_COMPLETED:
       ScheduleStateMachine();