Bug 1370130 - dormant timeout should take precedence over preload='metadata'. draft
authorJW Wang <jwwang@mozilla.com>
Mon, 05 Jun 2017 10:38:43 +0800
changeset 588788 a7d11e7f3b83972b2dff91f3cc888764435f7e21
parent 588787 ea621690a60d7b4208fddff7423747ea00ebeb4d
child 588817 ae1f9b14675d4899e025cba558739d09ea63bec0
push id62154
push userjwwang@mozilla.com
push dateMon, 05 Jun 2017 02:39:26 +0000
bugs1370130
milestone55.0a1
Bug 1370130 - dormant timeout should take precedence over preload='metadata'. 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] () {