Bug 1258922: [MSE] P4. Set draining flag to true when skip to next keyframe failed. r=gerald a=ritu
authorJean-Yves Avenard <jyavenard@mozilla.com>
Thu, 05 May 2016 15:58:49 +1000
changeset 332790 b72de38736248444009bfef8043ced0f15383776
parent 332789 0ce7d0b3753b677f83c9a61c5f22491d506377bd
child 332791 ab5c53d6a29b302eeb924dde9e8b0d8494dfd6ec
push id6048
push userkmoir@mozilla.com
push dateMon, 06 Jun 2016 19:02:08 +0000
treeherdermozilla-beta@46d72a56c57d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgerald, ritu
bugs1258922
milestone48.0a2
Bug 1258922: [MSE] P4. Set draining flag to true when skip to next keyframe failed. r=gerald a=ritu 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
@@ -1381,16 +1381,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;