зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1346498 part 3 - implement the UpdateVideoDecodeMode() policy in MediaDecoder; r=jwwang
So, the MediaDecoder is the one who rules out the policy of suspending video decoder. We also extract all the policy rules into one single method, MediaDecoder::UpdateVideoDecodeMode(). MozReview-Commit-ID: IOQq6kFfkIs --HG-- extra : rebase_source : 3d92c63aed2545391c45cdd7c1236d5df0b8d2f8 extra : source : 9c6c5f22d25171a206e828faa2c7c91d47f748f1
This commit is contained in:
Родитель
e9c23fc1ad
Коммит
c2f38bd02d
|
@ -1310,7 +1310,7 @@ MediaDecoder::SetElementVisibility(bool aIsVisible)
|
|||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
mElementVisible = aIsVisible;
|
||||
mIsVisible = !mForcedHidden && mElementVisible;
|
||||
UpdateVideoDecodeMode();
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -1318,7 +1318,7 @@ MediaDecoder::SetForcedHidden(bool aForcedHidden)
|
|||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
mForcedHidden = aForcedHidden;
|
||||
SetElementVisibility(mElementVisible);
|
||||
UpdateVideoDecodeMode();
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -1326,6 +1326,30 @@ MediaDecoder::SetSuspendTaint(bool aTainted)
|
|||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
mHasSuspendTaint = aTainted;
|
||||
UpdateVideoDecodeMode();
|
||||
}
|
||||
|
||||
void
|
||||
MediaDecoder::UpdateVideoDecodeMode()
|
||||
{
|
||||
// The MDSM may yet be set.
|
||||
if (!mDecoderStateMachine) {
|
||||
return;
|
||||
}
|
||||
|
||||
// If mHasSuspendTaint is set, never suspend the video decoder.
|
||||
if (mHasSuspendTaint) {
|
||||
mDecoderStateMachine->SetVideoDecodeMode(VideoDecodeMode::Normal);
|
||||
return;
|
||||
}
|
||||
|
||||
// If mForcedHidden is set, suspend the video decoder anyway.
|
||||
// Otherwise, depends on the owner's visibility state.
|
||||
if (!mForcedHidden && mElementVisible) {
|
||||
mDecoderStateMachine->SetVideoDecodeMode(VideoDecodeMode::Normal);
|
||||
} else {
|
||||
mDecoderStateMachine->SetVideoDecodeMode(VideoDecodeMode::Suspend);
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -1504,6 +1528,7 @@ MediaDecoder::SetStateMachine(MediaDecoderStateMachine* aStateMachine)
|
|||
mDecoderStateMachine = aStateMachine;
|
||||
if (aStateMachine) {
|
||||
ConnectMirrors(aStateMachine);
|
||||
UpdateVideoDecodeMode();
|
||||
} else {
|
||||
DisconnectMirrors();
|
||||
}
|
||||
|
|
|
@ -383,6 +383,8 @@ private:
|
|||
// Returns true if the decoder can't participate in suspend-video-decoder.
|
||||
bool HasSuspendTaint() const;
|
||||
|
||||
void UpdateVideoDecodeMode();
|
||||
|
||||
/******
|
||||
* The following methods must only be called on the main
|
||||
* thread.
|
||||
|
|
Загрузка…
Ссылка в новой задаче