Bug 975782 - Stop delaying the load event when media fetch has stalled. r=cpearce, f=kinetik, a=sledru
authorKarl Tomlinson <karlt+@karlt.net>
Thu, 11 Dec 2014 14:51:10 +1300
changeset 242836 3abc61cb0abd
parent 242835 cdd335426a39
child 242837 a33308dd5af8
push id4319
push userryanvm@gmail.com
push date2015-01-14 14:36 +0000
treeherdermozilla-beta@f6d5f2303fea [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerscpearce, sledru
bugs975782
milestone36.0
Bug 975782 - Stop delaying the load event when media fetch has stalled. r=cpearce, f=kinetik, a=sledru
dom/html/HTMLMediaElement.cpp
testing/web-platform/meta/media-source/SourceBuffer-abort-removed.html.ini
testing/web-platform/meta/media-source/SourceBuffer-abort.html.ini
testing/web-platform/meta/media-source/mediasource-addsourcebuffer.html.ini
testing/web-platform/meta/media-source/mediasource-append-buffer.html.ini
testing/web-platform/meta/media-source/mediasource-appendwindow.html.ini
testing/web-platform/meta/media-source/mediasource-buffered.html.ini
testing/web-platform/meta/media-source/mediasource-endofstream-invaliderror.html.ini
testing/web-platform/meta/media-source/mediasource-multiple-attach.html.ini
testing/web-platform/meta/media-source/mediasource-remove.html.ini
testing/web-platform/meta/media-source/mediasource-sourcebuffer-mode.html.ini
testing/web-platform/meta/media-source/mediasource-sourcebufferlist.html.ini
--- a/dom/html/HTMLMediaElement.cpp
+++ b/dom/html/HTMLMediaElement.cpp
@@ -687,17 +687,18 @@ void HTMLMediaElement::AbortExistingLoad
   // things which can affect AddRemoveSelfReference
   AddRemoveSelfReference();
 
   mIsRunningSelectResource = false;
 }
 
 void HTMLMediaElement::NoSupportedMediaSourceError()
 {
-  NS_ASSERTION(mDelayingLoadEvent, "Load event not delayed during source selection?");
+  NS_ASSERTION(mNetworkState == NETWORK_LOADING,
+               "Not loading during source selection?");
 
   mError = new MediaError(this, nsIDOMMediaError::MEDIA_ERR_SRC_NOT_SUPPORTED);
   ChangeNetworkState(nsIDOMHTMLMediaElement::NETWORK_NO_SOURCE);
   DispatchAsyncEvent(NS_LITERAL_STRING("error"));
   // This clears mDelayingLoadEvent, so AddRemoveSelfReference will be called
   ChangeDelayLoadStatus(false);
 }
 
@@ -3106,21 +3107,26 @@ void HTMLMediaElement::CheckProgress(boo
     if (mDataTime > mProgressTime) {
       mDataTime = mProgressTime;
     }
     if (!mProgressTimer) {
       NS_ASSERTION(aHaveNewProgress,
                    "timer dispatched when there was no timer");
       // Were stalled.  Restart timer.
       StartProgressTimer();
+      if (!mLoadedDataFired) {
+        ChangeDelayLoadStatus(true);
+      }
     }
   }
 
   if (now - mDataTime >= TimeDuration::FromMilliseconds(STALL_MS)) {
     DispatchAsyncEvent(NS_LITERAL_STRING("stalled"));
+    ChangeDelayLoadStatus(false);
+
     NS_ASSERTION(mProgressTimer, "detected stalled without timer");
     // Stop timer events, which prevents repeated stalled events until there
     // is more progress.
     StopProgress();
   }
 }
 
 /* static */
--- a/testing/web-platform/meta/media-source/SourceBuffer-abort-removed.html.ini
+++ b/testing/web-platform/meta/media-source/SourceBuffer-abort-removed.html.ini
@@ -1,7 +1,6 @@
 [SourceBuffer-abort-removed.html]
   type: testharness
-  expected: TIMEOUT
   [SourceBuffer#abort (video/mp4) : if this object has been removed from the sourceBuffers attribute of the parent media source, then throw an INVALID_STATE_ERR exception and abort these steps.]
     expected:
       if os == "win" and version == "5.1.2600": FAIL
 
--- a/testing/web-platform/meta/media-source/SourceBuffer-abort.html.ini
+++ b/testing/web-platform/meta/media-source/SourceBuffer-abort.html.ini
@@ -1,7 +1,6 @@
 [SourceBuffer-abort.html]
   type: testharness
-  expected: TIMEOUT
   [SourceBuffer#abort() (video/mp4): Check the values of appendWindowStart and appendWindowEnd.]
     expected:
       if os == "win" and version == "5.1.2600": FAIL
 
--- a/testing/web-platform/meta/media-source/mediasource-addsourcebuffer.html.ini
+++ b/testing/web-platform/meta/media-source/mediasource-addsourcebuffer.html.ini
@@ -1,11 +1,10 @@
 [mediasource-addsourcebuffer.html]
   type: testharness
-  expected: TIMEOUT
   [Test addSourceBuffer() with Vorbis and VP8]
     expected: FAIL
 
   [Test addSourceBuffer() with Vorbis and VP8 in separate SourceBuffers]
     expected: FAIL
 
   [Test addSourceBuffer() with AAC and H.264]
     expected: FAIL
--- a/testing/web-platform/meta/media-source/mediasource-append-buffer.html.ini
+++ b/testing/web-platform/meta/media-source/mediasource-append-buffer.html.ini
@@ -1,11 +1,10 @@
 [mediasource-append-buffer.html]
   type: testharness
-  expected: TIMEOUT
   [Test MediaSource.removeSourceBuffer() call during a pending appendBuffer().]
     expected: FAIL
 
   [Test appending an empty ArrayBufferView.]
     expected: FAIL
 
   [Test appending an empty ArrayBuffer.]
     expected: FAIL
deleted file mode 100644
--- a/testing/web-platform/meta/media-source/mediasource-appendwindow.html.ini
+++ /dev/null
@@ -1,3 +0,0 @@
-[mediasource-appendwindow.html]
-  type: testharness
-  expected: TIMEOUT
--- a/testing/web-platform/meta/media-source/mediasource-buffered.html.ini
+++ b/testing/web-platform/meta/media-source/mediasource-buffered.html.ini
@@ -1,11 +1,10 @@
 [mediasource-buffered.html]
   type: testharness
-  expected: TIMEOUT
   [Demuxed content with different lengths]
     expected: FAIL
 
   [Muxed tracks with different lengths]
     expected: FAIL
 
   [Demuxed content with an empty buffered range on one SourceBuffer]
     expected: FAIL
deleted file mode 100644
--- a/testing/web-platform/meta/media-source/mediasource-endofstream-invaliderror.html.ini
+++ /dev/null
@@ -1,3 +0,0 @@
-[mediasource-endofstream-invaliderror.html]
-  type: testharness
-  expected: TIMEOUT
deleted file mode 100644
--- a/testing/web-platform/meta/media-source/mediasource-multiple-attach.html.ini
+++ /dev/null
@@ -1,3 +0,0 @@
-[mediasource-multiple-attach.html]
-  type: testharness
-  expected: TIMEOUT
--- a/testing/web-platform/meta/media-source/mediasource-remove.html.ini
+++ b/testing/web-platform/meta/media-source/mediasource-remove.html.ini
@@ -1,11 +1,10 @@
 [mediasource-remove.html]
   type: testharness
-  expected: TIMEOUT
   [Test removing all appended data.]
     expected: FAIL
 
   [Test removing beginning of appended data.]
     expected: FAIL
 
   [Test removing the middle of appended data.]
     expected: FAIL
--- a/testing/web-platform/meta/media-source/mediasource-sourcebuffer-mode.html.ini
+++ b/testing/web-platform/meta/media-source/mediasource-sourcebuffer-mode.html.ini
@@ -1,8 +1,7 @@
 [mediasource-sourcebuffer-mode.html]
   type: testharness
-  expected: TIMEOUT
   [Test setting SourceBuffer.mode and SourceBuffer.timestampOffset while parsing media segment.]
     expected: FAIL
   [Test setting SourceBuffer.mode]
     expected: FAIL # Not supported yet - see bug 1116353
 
--- a/testing/web-platform/meta/media-source/mediasource-sourcebufferlist.html.ini
+++ b/testing/web-platform/meta/media-source/mediasource-sourcebufferlist.html.ini
@@ -1,9 +1,8 @@
 [mediasource-sourcebufferlist.html]
   type: testharness
-  expected: TIMEOUT
   [Test SourceBufferList event dispatching.]
     expected: FAIL
 
   [Test that only 1 removesourcebuffer event fires on each SourceBufferList when the MediaSource closes.]
     expected: FAIL