Bug 1310140. Part 12 - move the HasVideo() check into HandleVideoSuspendTimeout(). r=kaku,kamidphish

If MDSM becomes invisible while decoding metadata, VisibilityChanged() will return early
because mInfo is still nothing. And MDSM will never suspend video decoding if there are no
visibility changes later. We should delay the check util the timer goes off and MDSM
needs to switch on the blank decoder.

MozReview-Commit-ID: Ids9MncpC2l

--HG--
extra : rebase_source : 77ab76b09bae3dec3447950a8f0a7fcffff565b7
extra : source : 4527aed6f0b4f3ac11981df4517adacf9a43b4a2
This commit is contained in:
JW Wang 2016-10-18 14:07:07 +08:00
Родитель 7290b9911b
Коммит 9f67fc7996
1 изменённых файлов: 10 добавлений и 10 удалений

Просмотреть файл

@ -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();