Bug 1548923 - part1 : abort 'TimeMarchesOn' algorithm during seeking. r=jya
authoralwu <alwu@mozilla.com>
Wed, 08 May 2019 17:33:36 +0000
changeset 532072 667010d35e3418a9b9b2a21086dd411cb931d6e9
parent 532071 8fea661662875f667e79d9204438ce3cbfacbb46
child 532073 894e0713977b72b7045412e8b70898723a9aacde
push id11265
push userffxbld-merge
push dateMon, 13 May 2019 10:53:39 +0000
treeherdermozilla-beta@77e0fe8dbdd3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjya
bugs1548923
milestone68.0a1
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 1548923 - part1 : abort 'TimeMarchesOn' algorithm during seeking. r=jya In the spec [1], it doesn't mention that we should only run `TimeMarchesOn` after media has started. Therefore, we should remove this return condition in order to update cue's state correctly no matter the media starts or not. In addition, according to the spec [2], `TimeMarchesOn` should be executed after seeking completed, we shouldn't not run it during seeking. [1] https://html.spec.whatwg.org/multipage/media.html#time-marches-on [2] https://html.spec.whatwg.org/multipage/media.html#seeking:time-marches-on Differential Revision: https://phabricator.services.mozilla.com/D29882
dom/html/TextTrackManager.cpp
--- a/dom/html/TextTrackManager.cpp
+++ b/dom/html/TextTrackManager.cpp
@@ -615,29 +615,29 @@ void TextTrackManager::TimeMarchesOn() {
     // stable state. So we dispatch a task to perform such operation later
     // instead.
     DispatchTimeMarchesOn();
     return;
   }
   WEBVTT_LOG("TimeMarchesOn");
 
   // Early return if we don't have any TextTracks or shutting down.
-  if (!mTextTracks || mTextTracks->Length() == 0 || IsShutdown()) {
+  if (!mTextTracks || mTextTracks->Length() == 0 || IsShutdown() ||
+      !mMediaElement) {
     return;
   }
 
   nsISupports* parentObject = mMediaElement->OwnerDoc()->GetParentObject();
   if (NS_WARN_IF(!parentObject)) {
     return;
   }
   nsCOMPtr<nsPIDOMWindowInner> window = do_QueryInterface(parentObject);
 
-  if (mMediaElement &&
-      (!(mMediaElement->GetPlayedOrSeeked()) || mMediaElement->Seeking())) {
-    WEBVTT_LOG("TimeMarchesOn seeking or post return");
+  if (mMediaElement->Seeking()) {
+    WEBVTT_LOG("TimeMarchesOn return during seeking");
     return;
   }
 
   // Step 3.
   auto currentPlaybackTime =
       media::TimeUnit::FromSeconds(mMediaElement->CurrentTime());
   bool hasNormalPlayback = !mHasSeeked;
   mHasSeeked = false;