Bug 1371188 P2 - remove ReRequestVideoWithSkipTask; draft
authorKaku Kuo <kaku@mozilla.com>
Mon, 12 Jun 2017 15:48:11 +0800
changeset 592443 c18f69fdab353ef7c233b43dc6bd8995b8c1dbea
parent 592442 99e5165166bf7fe1cbfb883146700f57626c401e
child 592444 47712c2c74af6b572c80b295a39428a387b98a3b
push id63394
push userbmo:kaku@mozilla.com
push dateMon, 12 Jun 2017 08:37:10 +0000
bugs1371188, 1316211, 1316462
milestone55.0a1
Bug 1371188 P2 - remove ReRequestVideoWithSkipTask; We're going to remove synchronous decoding in bug 1316211 and bug 1316462. Remove the skip-to-next-key-frame mechanism in synchronous decoding now. MozReview-Commit-ID: Jc1tSADK3i6
dom/media/MediaDecoderReader.cpp
--- a/dom/media/MediaDecoderReader.cpp
+++ b/dom/media/MediaDecoderReader.cpp
@@ -234,43 +234,16 @@ MediaDecoderReader::AsyncReadMetadata()
                  static_cast<uint32_t>(rv), metadata.mInfo->HasValidMedia());
     return MetadataPromise::CreateAndReject(NS_ERROR_DOM_MEDIA_METADATA_ERR, __func__);
   }
 
   // Success!
   return MetadataPromise::CreateAndResolve(Move(metadata), __func__);
 }
 
-class ReRequestVideoWithSkipTask : public Runnable
-{
-public:
-  ReRequestVideoWithSkipTask(MediaDecoderReader* aReader,
-                             const media::TimeUnit& aTimeThreshold)
-    : mReader(aReader)
-    , mTimeThreshold(aTimeThreshold)
-  {
-  }
-
-  NS_IMETHOD Run() override
-  {
-    MOZ_ASSERT(mReader->OnTaskQueue());
-
-    // Make sure ResetDecode hasn't been called in the mean time.
-    if (!mReader->mBaseVideoPromise.IsEmpty()) {
-      mReader->RequestVideoData(/* aSkip = */ true, mTimeThreshold);
-    }
-
-    return NS_OK;
-  }
-
-private:
-  RefPtr<MediaDecoderReader> mReader;
-  const media::TimeUnit mTimeThreshold;
-};
-
 class ReRequestAudioTask : public Runnable
 {
 public:
   explicit ReRequestAudioTask(MediaDecoderReader* aReader)
     : mReader(aReader)
   {
   }
 
@@ -295,25 +268,16 @@ MediaDecoderReader::RequestVideoData(boo
                                      const media::TimeUnit& aTimeThreshold)
 {
   RefPtr<VideoDataPromise> p = mBaseVideoPromise.Ensure(__func__);
   bool skip = aSkipToNextKeyframe;
   while (VideoQueue().GetSize() == 0 &&
          !VideoQueue().IsFinished()) {
     if (!DecodeVideoFrame(skip, aTimeThreshold)) {
       VideoQueue().Finish();
-    } else if (skip) {
-      // We still need to decode more data in order to skip to the next
-      // keyframe. Post another task to the decode task queue to decode
-      // again. We don't just decode straight in a loop here, as that
-      // would hog the decode task queue.
-      RefPtr<nsIRunnable> task(
-        new ReRequestVideoWithSkipTask(this, aTimeThreshold));
-      mTaskQueue->Dispatch(task.forget());
-      return p;
     }
   }
   if (VideoQueue().GetSize() > 0) {
     RefPtr<VideoData> v = VideoQueue().PopFront();
     mBaseVideoPromise.Resolve(v, __func__);
   } else if (VideoQueue().IsFinished()) {
     mBaseVideoPromise.Reject(NS_ERROR_DOM_MEDIA_END_OF_STREAM, __func__);
   } else {