Backed out 3 changesets (bug 1298594) because they weren't approved for uplift.
authorRyan VanderMeulen <ryanvm@gmail.com>
Fri, 09 Sep 2016 14:01:06 -0400
changeset 348094 236385abdffc17d9450a811263f66647da7cc408
parent 348093 2997ae20bac0d7cebeb238dc919b63d86100e9da
child 348095 68f57be1e4611d6164d16bf092468fd2b90bc48c
push id6389
push userraliiev@mozilla.com
push dateMon, 19 Sep 2016 13:38:22 +0000
treeherdermozilla-beta@01d67bfe6c81 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1298594
milestone50.0a2
backs out0ee7678d527b144dad11f42fe05ad76f9f880fdf
824368e159571df8e5eedee4d07652e9f7dcd17e
5a2f2368796f2a4f2ff0d48b588eb6a2d25dbdf6
Backed out 3 changesets (bug 1298594) because they weren't approved for uplift. Backed out changeset 0ee7678d527b (bug 1298594) Backed out changeset 824368e15957 (bug 1298594) Backed out changeset 5a2f2368796f (bug 1298594)
dom/html/HTMLMediaElement.cpp
dom/html/HTMLMediaElement.h
dom/media/MediaDecoderStateMachine.cpp
dom/media/mediasource/test/mochitest.ini
dom/media/mediasource/test/test_WaitingOnMissingDataEnded_mp4.html
--- a/dom/html/HTMLMediaElement.cpp
+++ b/dom/html/HTMLMediaElement.cpp
@@ -2501,16 +2501,17 @@ HTMLMediaElement::HTMLMediaElement(alrea
     mAllowCasting(false),
     mIsCasting(false),
     mAudioCaptured(false),
     mAudioCapturedByWindow(false),
     mPlayingBeforeSeek(false),
     mPlayingThroughTheAudioChannelBeforeSeek(false),
     mPausedForInactiveDocumentOrChannel(false),
     mEventDeliveryPaused(false),
+    mWaitingFired(false),
     mIsRunningLoadMethod(false),
     mIsDoingExplicitLoad(false),
     mIsLoadingFromSourceChildren(false),
     mDelayingLoadEvent(false),
     mIsRunningSelectResource(false),
     mHaveQueuedSelectResource(false),
     mSuspendedAfterFirstFrame(false),
     mAllowSuspendAfterFirstFrame(true),
@@ -4350,16 +4351,21 @@ HTMLMediaElement::UpdateReadyStateIntern
   }
 
   if (nextFrameStatus != MediaDecoderOwner::NEXT_FRAME_AVAILABLE) {
     LOG(LogLevel::Debug, ("MediaElement %p UpdateReadyStateInternal() "
                           "Next frame not available", this));
     if (mFirstFrameLoaded) {
       ChangeReadyState(nsIDOMHTMLMediaElement::HAVE_CURRENT_DATA);
     }
+    if (!mWaitingFired && nextFrameStatus == MediaDecoderOwner::NEXT_FRAME_UNAVAILABLE_BUFFERING) {
+      FireTimeUpdate(false);
+      DispatchAsyncEvent(NS_LITERAL_STRING("waiting"));
+      mWaitingFired = true;
+    }
     return;
   }
 
   if (!mFirstFrameLoaded) {
     // We haven't yet loaded the first frame, making us unable to determine
     // if we have enough valid data at the present stage.
     return;
   }
@@ -4408,43 +4414,32 @@ void HTMLMediaElement::ChangeReadyState(
     return;
   }
 
   LOG(LogLevel::Debug, ("%p Ready state changed to %s", this, gReadyStateToString[aState]));
 
   UpdateAudioChannelPlayingState();
 
   // Handle raising of "waiting" event during seek (see 4.8.10.9)
-  // or
-  // 4.8.12.7 Ready states:
-  // "If the previous ready state was HAVE_FUTURE_DATA or more, and the new
-  // ready state is HAVE_CURRENT_DATA or less
-  // If the media element was potentially playing before its readyState
-  // attribute changed to a value lower than HAVE_FUTURE_DATA, and the element
-  // has not ended playback, and playback has not stopped due to errors,
-  // paused for user interaction, or paused for in-band content, the user agent
-  // must queue a task to fire a simple event named timeupdate at the element,
-  // and queue a task to fire a simple event named waiting at the element."
   if (mPlayingBeforeSeek &&
       mReadyState < nsIDOMHTMLMediaElement::HAVE_FUTURE_DATA) {
     DispatchAsyncEvent(NS_LITERAL_STRING("waiting"));
-  } else if (oldState >= nsIDOMHTMLMediaElement::HAVE_FUTURE_DATA &&
-             mReadyState < nsIDOMHTMLMediaElement::HAVE_FUTURE_DATA &&
-             !Paused() && !Ended() && !mError) {
-    FireTimeUpdate(false);
-    DispatchAsyncEvent(NS_LITERAL_STRING("waiting"));
   }
 
   if (oldState < nsIDOMHTMLMediaElement::HAVE_CURRENT_DATA &&
       mReadyState >= nsIDOMHTMLMediaElement::HAVE_CURRENT_DATA &&
       !mLoadedDataFired) {
     DispatchAsyncEvent(NS_LITERAL_STRING("loadeddata"));
     mLoadedDataFired = true;
   }
 
+  if (mReadyState == nsIDOMHTMLMediaElement::HAVE_CURRENT_DATA) {
+    mWaitingFired = false;
+  }
+
   if (oldState < nsIDOMHTMLMediaElement::HAVE_FUTURE_DATA &&
       mReadyState >= nsIDOMHTMLMediaElement::HAVE_FUTURE_DATA) {
     DispatchAsyncEvent(NS_LITERAL_STRING("canplay"));
   }
 
   CheckAutoplayDataReady();
 
   if (oldState < nsIDOMHTMLMediaElement::HAVE_FUTURE_DATA &&
--- a/dom/html/HTMLMediaElement.h
+++ b/dom/html/HTMLMediaElement.h
@@ -1450,16 +1450,20 @@ protected:
 
   // True iff this element is paused because the document is inactive or has
   // been suspended by the audio channel service.
   bool mPausedForInactiveDocumentOrChannel;
 
   // True iff event delivery is suspended (mPausedForInactiveDocumentOrChannel must also be true).
   bool mEventDeliveryPaused;
 
+  // True if we've reported a "waiting" event since the last
+  // readyState change to HAVE_CURRENT_DATA.
+  bool mWaitingFired;
+
   // True if we're running the "load()" method.
   bool mIsRunningLoadMethod;
 
   // True if we're running or waiting to run queued tasks due to an explicit
   // call to "load()".
   bool mIsDoingExplicitLoad;
 
   // True if we're loading the resource from the child source elements.
--- a/dom/media/MediaDecoderStateMachine.cpp
+++ b/dom/media/MediaDecoderStateMachine.cpp
@@ -2515,22 +2515,16 @@ void MediaDecoderStateMachine::UpdateNex
     statusString = "NEXT_FRAME_AVAILABLE";
   } else {
     status = MediaDecoderOwner::NEXT_FRAME_UNAVAILABLE;
     statusString = "NEXT_FRAME_UNAVAILABLE";
   }
 
   if (status != mNextFrameStatus) {
     DECODER_LOG("Changed mNextFrameStatus to %s", statusString);
-    if(status == MediaDecoderOwner::NEXT_FRAME_UNAVAILABLE_BUFFERING ||
-       status == MediaDecoderOwner::NEXT_FRAME_UNAVAILABLE) {
-      // Ensure currentTime is up to date prior updating mNextFrameStatus so that
-      // the MediaDecoderOwner fire events at correct currentTime.
-      UpdatePlaybackPositionPeriodically();
-    }
   }
 
   mNextFrameStatus = status;
 }
 
 bool MediaDecoderStateMachine::JustExitedQuickBuffering()
 {
   MOZ_ASSERT(OnTaskQueue());
--- a/dom/media/mediasource/test/mochitest.ini
+++ b/dom/media/mediasource/test/mochitest.ini
@@ -119,13 +119,11 @@ skip-if = ((os == "win" && os_version ==
 skip-if = ((os == "win" && os_version == "5.1") || (toolkit == 'android')) # Not supported on xp and android 2.3
 [test_TruncatedDuration.html]
 [test_TruncatedDuration_mp4.html]
 skip-if = ((os == "win" && os_version == "5.1") || (toolkit == 'android')) # Not supported on xp and android 2.3
 [test_WaitingOnMissingData.html]
 skip-if = true # Disabled due to bug 1124493 and friends. WebM MSE is deprioritized.
 [test_WaitingOnMissingData_mp4.html]
 skip-if = ((os == "win" && os_version == "5.1") || (toolkit == 'android')) # Not supported on xp and android 2.3
-[test_WaitingOnMissingDataEnded_mp4.html]
-skip-if = ((os == "win" && os_version == "5.1") || (toolkit == 'android')) # Not supported on xp and android 2.3
 [test_WaitingToEndedTransition_mp4.html]
 skip-if = ((os == "win" && os_version == "5.1") || (toolkit == 'android')) # Not supported on xp and android 2.3
 
deleted file mode 100644
--- a/dom/media/mediasource/test/test_WaitingOnMissingDataEnded_mp4.html
+++ /dev/null
@@ -1,53 +0,0 @@
-<!DOCTYPE html>
-<html><head>
-<meta http-equiv="content-type" content="text/html; charset=windows-1252">
-  <title>MSE: |waiting| event when source data is missing</title>
-  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
-  <script type="text/javascript" src="mediasource.js"></script>
-  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
-</head>
-<body>
-<pre id="test"><script class="testbody" type="text/javascript">
-
-SimpleTest.waitForExplicitFinish();
-
-runWithMSE(function(ms, el) {
-  el.controls = true;
-  once(ms, 'sourceopen').then(function() {
-    ok(true, "Receive a sourceopen event");
-    el.addEventListener("ended", function () {
-      ok(false, "ended should never fire");
-      SimpleTest.finish();
-    });
-    var videosb = ms.addSourceBuffer("video/mp4");
-    fetchAndLoad(videosb, 'bipbop/bipbop_video', ['init'], '.mp4')
-    .then(fetchAndLoad.bind(null, videosb, 'bipbop/bipbop_video', range(1, 5), '.m4s'))
-    .then(fetchAndLoad.bind(null, videosb, 'bipbop/bipbop_video', range(6, 8), '.m4s'))
-    .then(function() {
-      is(el.buffered.length, 2, "discontinuous buffered range");
-      ms.endOfStream();
-      return Promise.all([once(el, "durationchange"), once(ms, "sourceended")]);
-    }).then(function() {
-      // HTMLMediaElement fires 'waiting' if somebody invokes |play()| before the MDSM
-      // has notified it of available data. Make sure that we get 'playing' before
-      // we starting waiting for 'waiting'.
-      info("Invoking play()");
-      el.play();
-      return once(el, 'playing');
-    }).then(function() {
-      ok(true, "Video playing. It should play for a bit, then fire 'waiting'");
-      return once(el, 'waiting');
-    }).then(function() {
-      // waiting is fired when we start to play the last frame.
-      // 0.033334 is the duration of the last frame, + 0.000001 of fuzz.
-      // the next video frame, currentTime can be up to 1 frame's worth earlier than end of video.
-      isfuzzy(el.currentTime, videosb.buffered.end(0), 0.033334, "waiting was fired on gap");
-      SimpleTest.finish();
-    });
-  });
-});
-
-</script>
-</pre>
-</body>
-</html>