Bug 1511235 - part1 : suspend video decoding for video whose visibility state is UNTRACK. r=jya
☠☠ backed out by ef4f3c28e91c ☠ ☠
authoralwu <alwu@mozilla.com>
Mon, 10 Dec 2018 18:21:13 +0000
changeset 450207 3432e8bee7f1
parent 450206 cc946b482d75
child 450208 4c9f874d6868
push id35192
push userrmaries@mozilla.com
push dateWed, 12 Dec 2018 16:30:58 +0000
treeherdermozilla-central@418b19d4ba3d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjya
bugs1511235
milestone66.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 1511235 - part1 : suspend video decoding for video whose visibility state is UNTRACK. r=jya If video has not been within the potential visible range (which is larger than viewport) yet, its visibility state won't be updated and would stay in 'UNTRACK'. As those kinds of video are still invisible to users, we don't need to decode any video frames, we can suspend their video decoding until they're going to be visible. Differential Revision: https://phabricator.services.mozilla.com/D13804
dom/media/MediaDecoder.cpp
--- a/dom/media/MediaDecoder.cpp
+++ b/dom/media/MediaDecoder.cpp
@@ -962,21 +962,23 @@ void MediaDecoder::UpdateVideoDecodeMode
   AbstractThread::AutoEnter context(mAbstractMainThread);
 
   // The MDSM may yet be set.
   if (!mDecoderStateMachine) {
     LOG("UpdateVideoDecodeMode(), early return because we don't have MDSM.");
     return;
   }
 
-  // If an element is in-tree with UNTRACKED visibility, the visibility is
-  // incomplete and don't update the video decode mode.
+  // If the element is in-tree with UNTRACKED visibility, that means the element
+  // is not close enough to the viewport so we have not start to update its
+  // visibility. In this case, it's equals to invisible.
   if (mIsElementInTree && mElementVisibility == Visibility::UNTRACKED) {
-    LOG("UpdateVideoDecodeMode(), early return because we have incomplete "
-        "visibility states.");
+    LOG("UpdateVideoDecodeMode(), set Suspend because element hasn't be "
+        "updated visibility state.");
+    mDecoderStateMachine->SetVideoDecodeMode(VideoDecodeMode::Suspend);
     return;
   }
 
   // If mHasSuspendTaint is set, never suspend the video decoder.
   if (mHasSuspendTaint) {
     LOG("UpdateVideoDecodeMode(), set Normal because the element has been "
         "tainted.");
     mDecoderStateMachine->SetVideoDecodeMode(VideoDecodeMode::Normal);