Bug 1381376 - only suspend decoding when the pref is on. draft
authorAlastor Wu <alwu@mozilla.com>
Mon, 17 Jul 2017 18:38:35 +0800
changeset 609721 26dd133e10f4ebfd3c380255adc60ba492e57888
parent 609719 e44f48d90807ab656c9e72abd7bbf5e6280cbeff
child 637645 e6a25cfcd18ad3c220fc52e602f15dd72f77fd09
push id68660
push useralwu@mozilla.com
push dateMon, 17 Jul 2017 10:38:49 +0000
bugs1381376
milestone56.0a1
Bug 1381376 - only suspend decoding when the pref is on. Only suspend decoding when the pref is on, but resuming could be done when the pref is off. MozReview-Commit-ID: JDh1pRXNhc8
dom/media/MediaDecoderStateMachine.cpp
--- a/dom/media/MediaDecoderStateMachine.cpp
+++ b/dom/media/MediaDecoderStateMachine.cpp
@@ -3116,17 +3116,19 @@ void MediaDecoderStateMachine::SetVideoD
 void MediaDecoderStateMachine::SetVideoDecodeModeInternal(VideoDecodeMode aMode)
 {
   MOZ_ASSERT(OnTaskQueue());
   LOG("VideoDecodeModeChanged: VideoDecodeMode=(%s->%s), mVideoDecodeSuspended=%c",
       mVideoDecodeMode == VideoDecodeMode::Normal ? "Normal" : "Suspend",
       aMode == VideoDecodeMode::Normal ? "Normal" : "Suspend",
       mVideoDecodeSuspended ? 'T' : 'F');
 
-  if (!MediaPrefs::MDSMSuspendBackgroundVideoEnabled()) {
+  // Should not suspend decoding if we don't turn on the pref.
+  if (!MediaPrefs::MDSMSuspendBackgroundVideoEnabled() &&
+      aMode == VideoDecodeMode::Suspend) {
     return;
   }
 
   if (aMode == mVideoDecodeMode) {
     return;
   }
 
   // Set new video decode mode.