зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1347892 part 2 - pass the visibility state of media element to media decoder as a Visibility variable; r=jwwang
MozReview-Commit-ID: AbkJeIpYZlN --HG-- extra : rebase_source : 3ace472786b9b9900b125164996819b6d6e3627f
This commit is contained in:
Родитель
6da6d229fa
Коммит
0696209786
|
@ -7409,7 +7409,7 @@ HTMLMediaElement::NotifyDecoderActivityChanges() const
|
|||
{
|
||||
if (mDecoder) {
|
||||
mDecoder->NotifyOwnerActivityChanged(!IsHidden(),
|
||||
mVisibilityState == Visibility::APPROXIMATELY_VISIBLE,
|
||||
mVisibilityState,
|
||||
IsInUncomposedDoc());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -297,12 +297,12 @@ MediaDecoder::ResourceCallback::NotifyBytesConsumed(int64_t aBytes,
|
|||
|
||||
void
|
||||
MediaDecoder::NotifyOwnerActivityChanged(bool aIsDocumentVisible,
|
||||
bool aIsElementVisible,
|
||||
Visibility aElementVisibility,
|
||||
bool aIsElementInTree)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
MOZ_DIAGNOSTIC_ASSERT(!IsShutdown());
|
||||
SetElementVisibility(aIsDocumentVisible, aIsElementVisible, aIsElementInTree);
|
||||
SetElementVisibility(aIsDocumentVisible, aElementVisibility, aIsElementInTree);
|
||||
|
||||
NotifyCompositor();
|
||||
}
|
||||
|
@ -395,7 +395,7 @@ MediaDecoder::MediaDecoder(MediaDecoderOwner* aOwner)
|
|||
, mMinimizePreroll(false)
|
||||
, mFiredMetadataLoaded(false)
|
||||
, mIsDocumentVisible(false)
|
||||
, mIsElementVisible(false)
|
||||
, mElementVisibility(Visibility::UNTRACKED)
|
||||
, mIsElementInTree(false)
|
||||
, mForcedHidden(false)
|
||||
, mHasSuspendTaint(false)
|
||||
|
@ -1281,12 +1281,12 @@ MediaDecoder::NotifyCompositor()
|
|||
|
||||
void
|
||||
MediaDecoder::SetElementVisibility(bool aIsDocumentVisible,
|
||||
bool aIsElementVisible,
|
||||
Visibility aElementVisibility,
|
||||
bool aIsElementInTree)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
mIsDocumentVisible = aIsDocumentVisible;
|
||||
mIsElementVisible = aIsElementVisible;
|
||||
mElementVisibility = aElementVisibility;
|
||||
mIsElementInTree = aIsElementInTree;
|
||||
UpdateVideoDecodeMode();
|
||||
}
|
||||
|
@ -1336,7 +1336,8 @@ MediaDecoder::UpdateVideoDecodeMode()
|
|||
// Otherwise, depends on the owner's visibility state.
|
||||
// A element is visible only if its document is visible and the element
|
||||
// itself is visible.
|
||||
if (mIsDocumentVisible && mIsElementVisible) {
|
||||
if (mIsDocumentVisible &&
|
||||
mElementVisibility == Visibility::APPROXIMATELY_VISIBLE) {
|
||||
mDecoderStateMachine->SetVideoDecodeMode(VideoDecodeMode::Normal);
|
||||
} else {
|
||||
mDecoderStateMachine->SetVideoDecodeMode(VideoDecodeMode::Suspend);
|
||||
|
|
|
@ -50,6 +50,7 @@ class VideoFrameContainer;
|
|||
class MediaDecoderStateMachine;
|
||||
|
||||
enum class MediaEventType : int8_t;
|
||||
enum class Visibility : uint8_t;
|
||||
|
||||
// GetCurrentTime is defined in winbase.h as zero argument macro forwarding to
|
||||
// GetTickCount() and conflicts with MediaDecoder::GetCurrentTime implementation.
|
||||
|
@ -190,7 +191,7 @@ public:
|
|||
|
||||
// Notify activity of the decoder owner is changed.
|
||||
virtual void NotifyOwnerActivityChanged(bool aIsDocumentVisible,
|
||||
bool aIsElementVisible,
|
||||
Visibility aElementVisibility,
|
||||
bool aIsElementInTree);
|
||||
|
||||
// Pause video playback.
|
||||
|
@ -374,7 +375,7 @@ private:
|
|||
|
||||
// Called from HTMLMediaElement when owner document activity changes
|
||||
virtual void SetElementVisibility(bool aIsDocumentVisible,
|
||||
bool aIsElementVisible,
|
||||
Visibility aElementVisibility,
|
||||
bool aIsElementInTree);
|
||||
|
||||
// Force override the visible state to hidden.
|
||||
|
@ -711,7 +712,7 @@ protected:
|
|||
bool mIsDocumentVisible;
|
||||
|
||||
// Tracks the visibility status of owner element.
|
||||
bool mIsElementVisible;
|
||||
Visibility mElementVisibility;
|
||||
|
||||
// Tracks the owner is in-tree or not.
|
||||
bool mIsElementInTree;
|
||||
|
|
Загрузка…
Ссылка в новой задаче