Bug 1378691 P3 - trigger skip-to-next-key-frame if the video decoding is too slow; draft
authorKaku Kuo <kaku@mozilla.com>
Wed, 05 Jul 2017 14:18:40 +0800
changeset 605206 78046f0435c294f96a1b013a6a6a9bbbbe3ef6b9
parent 605205 4ec19bdf005d75361853c405fe93751026e023f7
child 605207 bca07c9c7c548867ba76e555bea126d16d7cf7c0
push id67324
push userbmo:kaku@mozilla.com
push dateFri, 07 Jul 2017 06:36:43 +0000
bugs1378691
milestone56.0a1
Bug 1378691 P3 - trigger skip-to-next-key-frame if the video decoding is too slow; MozReview-Commit-ID: H5tL4EseLvz
dom/media/MediaDecoderStateMachine.cpp
--- a/dom/media/MediaDecoderStateMachine.cpp
+++ b/dom/media/MediaDecoderStateMachine.cpp
@@ -1289,17 +1289,17 @@ protected:
   }
 
   void RequestAudioData()
   {
     MOZ_ASSERT(!mDoneAudioSeeking);
     mMaster->RequestAudioData();
   }
 
-  void RequestVideoData()
+  virtual void RequestVideoData()
   {
     MOZ_ASSERT(!mDoneVideoSeeking);
     mMaster->RequestVideoData(media::TimeUnit());
   }
 
   void AdjustFastSeekIfNeeded(MediaData* aSample)
   {
     if (mSeekJob.mTarget->IsFast()
@@ -1812,16 +1812,24 @@ public:
   void Step() override
   {
     // Keep update the current time in JS, so that JS players, such as YouTube,
     // are able to keep buffering.
     mMaster->UpdatePlaybackPositionPeriodically();
   }
 
 private:
+  // Trigger skip-to-next-key-frame if the video decoding is too slow to catch
+  // up playback position.
+  void RequestVideoData() override
+  {
+    MOZ_ASSERT(!mDoneVideoSeeking);
+    mMaster->RequestVideoData(GetSeekTarget());
+  }
+
   // Drop video until catch up playback position.
   media::TimeUnit GetSeekTarget() const override
   {
     return mMaster->mMediaSink->IsStarted()
            ? mMaster->GetClock()
            : mSeekJob.mTarget->GetTime();
   }
 };