Bug 879717 - Part 2. Avoid autoplaying stream-backed HTMLMediaElements blocking indefinitely. r=roc
☠☠ backed out by 4fe8ca5b1c15 ☠ ☠
authorAndreas Pehrson <pehrsons@gmail.com>
Fri, 03 Oct 2014 21:38:03 +0200
changeset 208807 6e2c7dd63fcf6e92005c308c50f77e6482c4927e
parent 208806 c42b68e0db15beeb85d1b38cff9b78aaffe8eed4
child 208808 0343643a16ce571129e278adb11fb18431dc67e5
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewersroc
bugs879717
milestone35.0a1
Bug 879717 - Part 2. Avoid autoplaying stream-backed HTMLMediaElements blocking indefinitely. r=roc
content/html/content/src/HTMLMediaElement.cpp
--- a/content/html/content/src/HTMLMediaElement.cpp
+++ b/content/html/content/src/HTMLMediaElement.cpp
@@ -3281,24 +3281,24 @@ void HTMLMediaElement::ChangeNetworkStat
   } else if (mNetworkState == nsIDOMHTMLMediaElement::NETWORK_IDLE && !mError) {
     // Fire 'suspend' event when entering NETWORK_IDLE and no error presented.
     DispatchAsyncEvent(NS_LITERAL_STRING("suspend"));
   }
 }
 
 bool HTMLMediaElement::CanActivateAutoplay()
 {
-  // For stream inputs, we activate autoplay on HAVE_CURRENT_DATA because
+  // For stream inputs, we activate autoplay on HAVE_METADATA because
   // this element itself might be blocking the stream from making progress by
   // being paused.
   return !mPausedForInactiveDocumentOrChannel &&
          mAutoplaying &&
          mPaused &&
          ((mDecoder && mReadyState >= nsIDOMHTMLMediaElement::HAVE_ENOUGH_DATA) ||
-          (mSrcStream && mReadyState >= nsIDOMHTMLMediaElement::HAVE_CURRENT_DATA)) &&
+          (mSrcStream && mReadyState >= nsIDOMHTMLMediaElement::HAVE_METADATA)) &&
          HasAttr(kNameSpaceID_None, nsGkAtoms::autoplay) &&
          mAutoplayEnabled &&
          !IsEditable();
 }
 
 void HTMLMediaElement::CheckAutoplayDataReady()
 {
   if (CanActivateAutoplay()) {