Bug 1312886: [MSE] P3. Only rely on waiting promise to determine buffering state. r?jwwang draft
authorJean-Yves Avenard <jyavenard@mozilla.com>
Thu, 27 Oct 2016 20:16:30 +1100
changeset 430760 0a04be673e532be63c8f8996371d6eb7cf2028b5
parent 430759 f921259d51206b2fd4b16a8ed322cddb34de373b
child 430761 dac3a29045f5ccb94e2f0aec9e3f7921b06945bc
push id33879
push userbmo:jyavenard@mozilla.com
push dateFri, 28 Oct 2016 03:36:01 +0000
reviewersjwwang
bugs1312886
milestone52.0a1
Bug 1312886: [MSE] P3. Only rely on waiting promise to determine buffering state. r?jwwang MozReview-Commit-ID: 3HfK8bwqlYM
dom/media/MediaDecoderStateMachine.cpp
--- a/dom/media/MediaDecoderStateMachine.cpp
+++ b/dom/media/MediaDecoderStateMachine.cpp
@@ -1464,24 +1464,21 @@ DecodingState::MaybeStartBuffering()
   }
 
   // Don't enter buffering while prerolling so that the decoder has a chance to
   // enqueue some decoded data before we give up and start buffering.
   if (!mMaster->IsPlaying()) {
     return;
   }
 
-  // No more data to download. No need to enter buffering.
-  if (!Resource()->IsExpectingMoreData()) {
-    return;
-  }
-
   bool shouldBuffer;
   if (Reader()->UseBufferingHeuristics()) {
-    shouldBuffer = mMaster->HasLowDecodedData() && mMaster->HasLowBufferedData();
+    shouldBuffer = Resource()->IsExpectingMoreData() &&
+                   mMaster->HasLowDecodedData() &&
+                   mMaster->HasLowBufferedData();
   } else {
     MOZ_ASSERT(Reader()->IsWaitForDataSupported());
     shouldBuffer =
       (mMaster->OutOfDecodedAudio() && Reader()->IsWaitingAudioData()) ||
       (mMaster->OutOfDecodedVideo() && Reader()->IsWaitingVideoData());
   }
   if (shouldBuffer) {
     SetState<BufferingState>();