Bug 1451149 - P2. Don't fire the "stalled" event when using MSE. r=bryce
authorJean-Yves Avenard <jyavenard@mozilla.com>
Mon, 14 May 2018 11:32:09 +0200
changeset 476479 b3350fc6da3aca627f12da57ff55805fdbe7c6b2
parent 476478 b7c3ae209716b3d0798e5333ac2b57ce5846d3a5
child 476480 143be456f42025327408b28871585ed0d7b53742
push id1757
push userffxbld-merge
push dateFri, 24 Aug 2018 17:02:43 +0000
treeherdermozilla-release@736023aebdb1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
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 1451149 - P2. Don't fire the "stalled" event when using MSE. r=bryce When using a media element with a Media Source, the resource fetching algorithm is to be called in "local" mode: https://www.w3.org/TR/media-source/#mediasource-attach "Continue the resource fetch algorithm by running the remaining "Otherwise (mode is local)" steps, with these clarifications" https://html.spec.whatwg.org/multipage/media.html#concept-media-load-resource Under the local mode, the steps that would cause the element to fire suspend, stalled or progress can never occur. We only prevent the stalled event to be fired, many websites rely on the progress event to be fired (such as when the init segment has been parsed). The HTML5 media spec will be amended to clearly indicate that progress is to be fired even with mediasource MozReview-Commit-ID: DkoQzoV0JzO
--- a/dom/html/HTMLMediaElement.cpp
+++ b/dom/html/HTMLMediaElement.cpp
@@ -5712,19 +5712,19 @@ HTMLMediaElement::CheckProgress(bool aHa
     // Download statistics may have been updated, force a recheck of the
     // readyState.
   if (now - mDataTime >= TimeDuration::FromMilliseconds(STALL_MS)) {
-    DispatchAsyncEvent(NS_LITERAL_STRING("stalled"));
-    if (mMediaSource) {
+    if (!mMediaSource) {
+      DispatchAsyncEvent(NS_LITERAL_STRING("stalled"));
+    } else {
     NS_ASSERTION(mProgressTimer, "detected stalled without timer");
     // Stop timer events, which prevents repeated stalled events until there
     // is more progress.
--- a/dom/media/mediasource/test/test_ChangeWhileWaitingOnMissingData_mp4.html
+++ b/dom/media/mediasource/test/test_ChangeWhileWaitingOnMissingData_mp4.html
@@ -18,17 +18,17 @@ runWithMSE(function(ms, el) {
     const sb = ms.addSourceBuffer("video/mp4");
     fetchAndLoad(sb, "bipbop/bipbop_480_624kbps-video", [ "init" ], ".mp4")
     .then(fetchAndLoad.bind(null, sb, "bipbop/bipbop_480_624kbps-video", range(1, 3), ".m4s"))
     .then(function() {
       // let seek to the last audio frame.
       // The seek will complete and then playback will stall.
       el.currentTime = 1.532517;
-      return Promise.all([ once(el, "seeked"), once(el, "stalled") ]);
+      return Promise.all([ once(el, "seeked"), once(el, "waiting") ]);
     .then(function() {
       info("seek completed");
       return fetchAndLoad(sb, "bipbop/bipbop", [ "init" ], ".mp4");
     .then(fetchAndLoad.bind(null, sb, "bipbop/bipbop", range(1, 4), ".m4s"))
     .then(function() {