Bug 1325905. Part 5 - let DecodingFirstFrameState override Handle{Audio,Video}Waited. draft
authorJW Wang <jwwang@mozilla.com>
Wed, 21 Dec 2016 18:23:00 +0800
changeset 454469 dcf003553f40620139b37c799b2674f551bd546f
parent 454468 3b69a728ed9c1433f398b9e5688b19ea3849eb3c
child 454470 d453051ec55dbef1325de05658043a8afc849a55
push id39938
push userjwwang@mozilla.com
push dateThu, 29 Dec 2016 11:35:09 +0000
bugs1325905
milestone53.0a1
Bug 1325905. Part 5 - let DecodingFirstFrameState override Handle{Audio,Video}Waited. We want to call Request{Audio,Video}Data() instead of Ensure{Audio,Video}DecodeTaskQueued which checks mState and breaks the encapsulation of the state objects. MozReview-Commit-ID: 5oydItSvnMF
dom/media/MediaDecoderStateMachine.cpp
--- a/dom/media/MediaDecoderStateMachine.cpp
+++ b/dom/media/MediaDecoderStateMachine.cpp
@@ -495,16 +495,26 @@ public:
   {
     mMaster->PushVideo(aVideo);
     MaybeFinishDecodeFirstFrame();
   }
 
   void HandleAudioNotDecoded(const MediaResult& aError) override;
   void HandleVideoNotDecoded(const MediaResult& aError) override;
 
+  void HandleAudioWaited(MediaData::Type aType) override
+  {
+    mMaster->RequestAudioData();
+  }
+
+  void HandleVideoWaited(MediaData::Type aType) override
+  {
+    mMaster->RequestVideoData(false, media::TimeUnit());
+  }
+
   void HandleVideoSuspendTimeout() override
   {
     // Do nothing for we need to decode the 1st video frame to get the dimensions.
   }
 
   void HandleResumeVideoDecoding() override
   {
     // We never suspend video decoding in this state.