Bug 1550585 - no need to check whether media is playing when dispatching 'TimeMarchesOn' and 'UpdateCueDisplay'. r=jya
authorAlastor Wu <alwu@mozilla.com>
Fri, 17 May 2019 01:12:37 +0000
changeset 474280 45d495a1a3a97f659451ce077d17d8e23fba7fb4
parent 474279 5745d2f2bf46a0962ba405ab1d2b705630376d7f
child 474281 95ccc685eb11f356e7b8c8be9ed2bea601585a4e
push id113144
push usershindli@mozilla.com
push dateFri, 17 May 2019 16:44:55 +0000
treeherdermozilla-inbound@f4c4b796f845 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjya
bugs1550585
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 1550585 - no need to check whether media is playing when dispatching 'TimeMarchesOn' and 'UpdateCueDisplay'. r=jya The spec [1] doesn't mention that we should run `TimeMarchesOn` or `UpdateCueDisplay` only after media starts playing. Removing the checking can help us to render the cue correctly no matter media starts or not. [1] https://html.spec.whatwg.org/multipage/media.html#time-marches-on Differential Revision: https://phabricator.services.mozilla.com/D31504
dom/html/TextTrackManager.cpp
--- a/dom/html/TextTrackManager.cpp
+++ b/dom/html/TextTrackManager.cpp
@@ -563,18 +563,17 @@ class TextTrackListInternal {
     return mTextTracks.SafeElementAt(aIndex, nullptr);
   }
 
  private:
   nsTArray<RefPtr<TextTrack>> mTextTracks;
 };
 
 void TextTrackManager::DispatchUpdateCueDisplay() {
-  if (!mUpdateCueDisplayDispatched && !IsShutdown() &&
-      mMediaElement->IsCurrentlyPlaying()) {
+  if (!mUpdateCueDisplayDispatched && !IsShutdown()) {
     WEBVTT_LOG("DispatchUpdateCueDisplay");
     nsPIDOMWindowInner* win = mMediaElement->OwnerDoc()->GetInnerWindow();
     if (win) {
       nsGlobalWindowInner::Cast(win)->Dispatch(
           TaskCategory::Other,
           NewRunnableMethod("dom::TextTrackManager::UpdateCueDisplay", this,
                             &TextTrackManager::UpdateCueDisplay));
       mUpdateCueDisplayDispatched = true;
@@ -582,18 +581,17 @@ void TextTrackManager::DispatchUpdateCue
   }
 }
 
 void TextTrackManager::DispatchTimeMarchesOn() {
   // Run the algorithm if no previous instance is still running, otherwise
   // enqueue the current playback position and whether only that changed
   // through its usual monotonic increase during normal playback; current
   // executing call upon completion will check queue for further 'work'.
-  if (!mTimeMarchesOnDispatched && !IsShutdown() &&
-      mMediaElement->IsCurrentlyPlaying()) {
+  if (!mTimeMarchesOnDispatched && !IsShutdown()) {
     WEBVTT_LOG("DispatchTimeMarchesOn");
     nsPIDOMWindowInner* win = mMediaElement->OwnerDoc()->GetInnerWindow();
     if (win) {
       nsGlobalWindowInner::Cast(win)->Dispatch(
           TaskCategory::Other,
           NewRunnableMethod("dom::TextTrackManager::TimeMarchesOn", this,
                             &TextTrackManager::TimeMarchesOn));
       mTimeMarchesOnDispatched = true;