Bug 1370130 - dormant timeout should take precedence over preload='metadata'. r=kaku
authorJW Wang <jwwang@mozilla.com>
Mon, 05 Jun 2017 10:38:43 +0800
changeset 410405 6e9e40efea3995e0472fd64507b2ee2b4f76d481
parent 410404 50075548c1ef7d1c6f42e38ddeeb24bb767d4d11
child 410406 8e78bd3e1e16594191f57bac69f9cd88460aa59d
push id7391
push usermtabara@mozilla.com
push dateMon, 12 Jun 2017 13:08:53 +0000
treeherdermozilla-beta@2191d7f87e2e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskaku
bugs1370130
milestone55.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 1370130 - dormant timeout should take precedence over preload='metadata'. r=kaku We don't want to enter dormant when preload is 'metadata' if the timeout is negative (dormant is disabled). MozReview-Commit-ID: 4KGAmtkZpH5
dom/media/MediaDecoderStateMachine.cpp
--- a/dom/media/MediaDecoderStateMachine.cpp
+++ b/dom/media/MediaDecoderStateMachine.cpp
@@ -889,31 +889,31 @@ private:
   void StartDormantTimer()
   {
     if (!mMaster->mMediaSeekable) {
       // Don't enter dormant if the media is not seekable because we need to
       // seek when exiting dormant.
       return;
     }
 
-    if (mMaster->mMinimizePreroll) {
-      SetState<DormantState>();
-      return;
-    }
-
     auto timeout = MediaPrefs::DormantOnPauseTimeout();
     if (timeout < 0) {
       // Disabled when timeout is negative.
       return;
     } else if (timeout == 0) {
       // Enter dormant immediately without scheduling a timer.
       SetState<DormantState>();
       return;
     }
 
+    if (mMaster->mMinimizePreroll) {
+      SetState<DormantState>();
+      return;
+    }
+
     TimeStamp target = TimeStamp::Now() +
       TimeDuration::FromMilliseconds(timeout);
 
     mDormantTimer.Ensure(target,
       [this] () {
         mDormantTimer.CompleteRequest();
         SetState<DormantState>();
       }, [this] () {