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
--- 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] () {