зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1346116 part 2 - consider a video is in-tree or not in the suspend-video-decoding policy; r=jwwang
We never suspend videos that is NOT in-tree because we found that, according to the Telemetry data, most (>70%) videos which are used as the argument of drawImage() are not in-tree. So, by preventing suspending not-in-tree videos, we should be able to alleviate the pain of not able to resume video decoders synchronously. MozReview-Commit-ID: 8eqs0pHZLIt --HG-- extra : rebase_source : 964c0047753696cad2e40bcf74c2b8ee9faccdea extra : source : 93c38caa15b1a29f8f1e8e6d3a5e859f97bc1aae
This commit is contained in:
Родитель
f758e455ea
Коммит
a1edb1f6ed
|
@ -7404,7 +7404,8 @@ HTMLMediaElement::NotifyDecoderActivityChanges() const
|
|||
{
|
||||
if (mDecoder) {
|
||||
mDecoder->NotifyOwnerActivityChanged(!IsHidden(),
|
||||
mVisibilityState == Visibility::APPROXIMATELY_VISIBLE);
|
||||
mVisibilityState == Visibility::APPROXIMATELY_VISIBLE,
|
||||
IsInUncomposedDoc());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -298,11 +298,12 @@ MediaDecoder::ResourceCallback::NotifyBytesConsumed(int64_t aBytes,
|
|||
|
||||
void
|
||||
MediaDecoder::NotifyOwnerActivityChanged(bool aIsDocumentVisible,
|
||||
bool aIsElementVisible)
|
||||
bool aIsElementVisible,
|
||||
bool aIsElementInTree)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
MOZ_DIAGNOSTIC_ASSERT(!IsShutdown());
|
||||
SetElementVisibility(aIsDocumentVisible, aIsElementVisible);
|
||||
SetElementVisibility(aIsDocumentVisible, aIsElementVisible, aIsElementInTree);
|
||||
|
||||
NotifyCompositor();
|
||||
}
|
||||
|
@ -397,6 +398,7 @@ MediaDecoder::MediaDecoder(MediaDecoderOwner* aOwner)
|
|||
, mFiredMetadataLoaded(false)
|
||||
, mIsDocumentVisible(false)
|
||||
, mIsElementVisible(false)
|
||||
, mIsElementInTree(false)
|
||||
, mForcedHidden(false)
|
||||
, mHasSuspendTaint(false)
|
||||
, INIT_MIRROR(mStateMachineIsShutdown, true)
|
||||
|
@ -1308,11 +1310,13 @@ MediaDecoder::NotifyCompositor()
|
|||
|
||||
void
|
||||
MediaDecoder::SetElementVisibility(bool aIsDocumentVisible,
|
||||
bool aIsElementVisible)
|
||||
bool aIsElementVisible,
|
||||
bool aIsElementInTree)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
mIsDocumentVisible = aIsDocumentVisible;
|
||||
mIsElementVisible = aIsElementVisible;
|
||||
mIsElementInTree = aIsElementInTree;
|
||||
UpdateVideoDecodeMode();
|
||||
}
|
||||
|
||||
|
@ -1346,6 +1350,12 @@ MediaDecoder::UpdateVideoDecodeMode()
|
|||
return;
|
||||
}
|
||||
|
||||
// Don't suspend elements that is not in tree.
|
||||
if (!mIsElementInTree) {
|
||||
mDecoderStateMachine->SetVideoDecodeMode(VideoDecodeMode::Normal);
|
||||
return;
|
||||
}
|
||||
|
||||
// If mForcedHidden is set, suspend the video decoder anyway.
|
||||
if (mForcedHidden) {
|
||||
mDecoderStateMachine->SetVideoDecodeMode(VideoDecodeMode::Suspend);
|
||||
|
|
|
@ -190,7 +190,8 @@ public:
|
|||
|
||||
// Notify activity of the decoder owner is changed.
|
||||
virtual void NotifyOwnerActivityChanged(bool aIsDocumentVisible,
|
||||
bool aIsElementVisible);
|
||||
bool aIsElementVisible,
|
||||
bool aIsElementInTree);
|
||||
|
||||
// Pause video playback.
|
||||
virtual void Pause();
|
||||
|
@ -373,7 +374,8 @@ private:
|
|||
|
||||
// Called from HTMLMediaElement when owner document activity changes
|
||||
virtual void SetElementVisibility(bool aIsDocumentVisible,
|
||||
bool aIsElementVisible);
|
||||
bool aIsElementVisible,
|
||||
bool aIsElementInTree);
|
||||
|
||||
// Force override the visible state to hidden.
|
||||
// Called from HTMLMediaElement when testing of video decode suspend from mochitests.
|
||||
|
@ -721,9 +723,12 @@ protected:
|
|||
// Tracks the visibility status of owner element's document.
|
||||
bool mIsDocumentVisible;
|
||||
|
||||
// Tracks the visibliity status of owner element.
|
||||
// Tracks the visibility status of owner element.
|
||||
bool mIsElementVisible;
|
||||
|
||||
// Tracks the owner is in-tree or not.
|
||||
bool mIsElementInTree;
|
||||
|
||||
// If true, forces the decoder to be considered hidden.
|
||||
bool mForcedHidden;
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче