Bug 1258922: [MSE] P4. Set draining flag to true when skip to next keyframe failed. r=gerald
authorJean-Yves Avenard <jyavenard@mozilla.com>
Thu, 05 May 2016 15:58:49 +1000
changeset 296347 6b20a2776b3a86e71be73dc58f0c2cebf64b4023
parent 296346 60941c0d1f9f536d235e8372949e507ef768a73c
child 296348 7d9879db28afb4371d7836f25fb40558095166cc
push id76303
push userjyavenard@mozilla.com
push dateFri, 06 May 2016 07:32:02 +0000
treeherdermozilla-inbound@7d9879db28af [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgerald
bugs1258922
milestone49.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 1258922: [MSE] P4. Set draining flag to true when skip to next keyframe failed. r=gerald data promise is only resolved once the decoder has been drained. It was possible for a promise to never be resolved if skipping to the next key frame failed. MozReview-Commit-ID: GimbQTImH9e
dom/media/MediaFormatReader.cpp
--- a/dom/media/MediaFormatReader.cpp
+++ b/dom/media/MediaFormatReader.cpp
@@ -1442,16 +1442,25 @@ MediaFormatReader::OnVideoSkipFailed(Med
     mDecoder->NotifyDecodedFrames(aFailure.mSkipped, 0, aFailure.mSkipped);
   }
   MOZ_ASSERT(mVideo.HasPromise());
   switch (aFailure.mFailure) {
     case DemuxerFailureReason::END_OF_STREAM:
       NotifyEndOfStream(TrackType::kVideoTrack);
       break;
     case DemuxerFailureReason::WAITING_FOR_DATA:
+      // While there is nothing to drain considering the decoder has been
+      // flushed in SkipVideoDemuxToNextKeyFrame, we need to set mNeedDraining
+      // to true as the video MediaDataPromise will only be rejected once drain
+      // has completed.
+      MOZ_DIAGNOSTIC_ASSERT(!mVideo.mDecodingRequested,
+                            "Reset must have been called");
+      if (!mVideo.mWaitingForData) {
+        mVideo.mNeedDraining = true;
+      }
       NotifyWaitingForData(TrackType::kVideoTrack);
       break;
     case DemuxerFailureReason::CANCELED:
     case DemuxerFailureReason::SHUTDOWN:
       if (mVideo.HasPromise()) {
         mVideo.RejectPromise(CANCELED, __func__);
       }
       break;