diff --git a/dom/media/MediaDecoderStateMachine.cpp b/dom/media/MediaDecoderStateMachine.cpp index 873517ad34a4..b754f744fa7a 100644 --- a/dom/media/MediaDecoderStateMachine.cpp +++ b/dom/media/MediaDecoderStateMachine.cpp @@ -532,9 +532,11 @@ public: void HandleVideoSuspendTimeout() override { - mMaster->mVideoDecodeSuspended = true; - mMaster->mOnPlaybackEvent.Notify(MediaEventType::EnterVideoSuspend); - Reader()->SetVideoBlankDecode(true); + if (mMaster->HasVideo()) { + mMaster->mVideoDecodeSuspended = true; + mMaster->mOnPlaybackEvent.Notify(MediaEventType::EnterVideoSuspend); + Reader()->SetVideoBlankDecode(true); + } } void DumpDebugInfo() override @@ -830,9 +832,11 @@ public: void HandleVideoSuspendTimeout() override { - mMaster->mVideoDecodeSuspended = true; - mMaster->mOnPlaybackEvent.Notify(MediaEventType::EnterVideoSuspend); - Reader()->SetVideoBlankDecode(true); + if (mMaster->HasVideo()) { + mMaster->mVideoDecodeSuspended = true; + mMaster->mOnPlaybackEvent.Notify(MediaEventType::EnterVideoSuspend); + Reader()->SetVideoBlankDecode(true); + } } private: @@ -2316,10 +2320,6 @@ void MediaDecoderStateMachine::VisibilityChanged() "mVideoDecodeSuspended=%c, mIsReaderSuspended=%d", mIsVisible.Ref(), mVideoDecodeSuspended ? 'T' : 'F', mIsReaderSuspended.Ref()); - if (mInfo.isNothing() || !HasVideo()) { - return; - } - // Start timer to trigger suspended decoding state when going invisible. if (!mIsVisible) { TimeStamp target = TimeStamp::Now() + SuspendBackgroundVideoDelay();