зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1521964 - Don't suspend the video decoder when cloning a video visually. r=jya
Differential Revision: https://phabricator.services.mozilla.com/D20674 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
59c1141de6
Коммит
44acc929a5
|
@ -471,6 +471,7 @@ void HTMLVideoElement::MaybeBeginCloningVisually() {
|
||||||
mVisualCloneTarget->GetVideoFrameContainer();
|
mVisualCloneTarget->GetVideoFrameContainer();
|
||||||
if (mdsm && container) {
|
if (mdsm && container) {
|
||||||
mdsm->SetSecondaryVideoContainer(container);
|
mdsm->SetSecondaryVideoContainer(container);
|
||||||
|
mDecoder->SetCloningVisually(true);
|
||||||
}
|
}
|
||||||
} else if (mSrcStream) {
|
} else if (mSrcStream) {
|
||||||
VideoFrameContainer* container =
|
VideoFrameContainer* container =
|
||||||
|
@ -488,6 +489,7 @@ void HTMLVideoElement::EndCloningVisually() {
|
||||||
MediaDecoderStateMachine* mdsm = mDecoder->GetStateMachine();
|
MediaDecoderStateMachine* mdsm = mDecoder->GetStateMachine();
|
||||||
if (mdsm) {
|
if (mdsm) {
|
||||||
mdsm->SetSecondaryVideoContainer(nullptr);
|
mdsm->SetSecondaryVideoContainer(nullptr);
|
||||||
|
mDecoder->SetCloningVisually(false);
|
||||||
}
|
}
|
||||||
} else if (mSrcStream) {
|
} else if (mSrcStream) {
|
||||||
VideoFrameContainer* container =
|
VideoFrameContainer* container =
|
||||||
|
|
|
@ -305,6 +305,7 @@ MediaDecoder::MediaDecoder(MediaDecoderInit& aInit)
|
||||||
mIsElementInTree(false),
|
mIsElementInTree(false),
|
||||||
mForcedHidden(false),
|
mForcedHidden(false),
|
||||||
mHasSuspendTaint(aInit.mHasSuspendTaint),
|
mHasSuspendTaint(aInit.mHasSuspendTaint),
|
||||||
|
mIsCloningVisually(false),
|
||||||
mPlaybackRate(aInit.mPlaybackRate),
|
mPlaybackRate(aInit.mPlaybackRate),
|
||||||
mLogicallySeeking(false, "MediaDecoder::mLogicallySeeking"),
|
mLogicallySeeking(false, "MediaDecoder::mLogicallySeeking"),
|
||||||
INIT_MIRROR(mBuffered, TimeIntervals()),
|
INIT_MIRROR(mBuffered, TimeIntervals()),
|
||||||
|
@ -988,6 +989,14 @@ void MediaDecoder::UpdateVideoDecodeMode() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If mIsCloningVisually is set, never suspend the video decoder.
|
||||||
|
if (mIsCloningVisually) {
|
||||||
|
LOG("UpdateVideoDecodeMode(), set Normal because the element is cloning "
|
||||||
|
"itself visually to another video container.");
|
||||||
|
mDecoderStateMachine->SetVideoDecodeMode(VideoDecodeMode::Normal);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Don't suspend elements that is not in tree.
|
// Don't suspend elements that is not in tree.
|
||||||
if (!mIsElementInTree) {
|
if (!mIsElementInTree) {
|
||||||
LOG("UpdateVideoDecodeMode(), set Normal because the element is not in "
|
LOG("UpdateVideoDecodeMode(), set Normal because the element is not in "
|
||||||
|
@ -1046,6 +1055,13 @@ bool MediaDecoder::HasSuspendTaint() const {
|
||||||
return mHasSuspendTaint;
|
return mHasSuspendTaint;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MediaDecoder::SetCloningVisually(bool aIsCloningVisually) {
|
||||||
|
if (mIsCloningVisually != aIsCloningVisually) {
|
||||||
|
mIsCloningVisually = aIsCloningVisually;
|
||||||
|
UpdateVideoDecodeMode();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool MediaDecoder::IsMediaSeekable() {
|
bool MediaDecoder::IsMediaSeekable() {
|
||||||
MOZ_ASSERT(NS_IsMainThread());
|
MOZ_ASSERT(NS_IsMainThread());
|
||||||
NS_ENSURE_TRUE(GetStateMachine(), false);
|
NS_ENSURE_TRUE(GetStateMachine(), false);
|
||||||
|
|
|
@ -308,6 +308,8 @@ class MediaDecoder : public DecoderDoctorLifeLogger<MediaDecoder> {
|
||||||
// Returns true if the decoder can't participate in suspend-video-decoder.
|
// Returns true if the decoder can't participate in suspend-video-decoder.
|
||||||
bool HasSuspendTaint() const;
|
bool HasSuspendTaint() const;
|
||||||
|
|
||||||
|
void SetCloningVisually(bool aIsCloningVisually);
|
||||||
|
|
||||||
void UpdateVideoDecodeMode();
|
void UpdateVideoDecodeMode();
|
||||||
|
|
||||||
void SetIsBackgroundVideoDecodingAllowed(bool aAllowed);
|
void SetIsBackgroundVideoDecodingAllowed(bool aAllowed);
|
||||||
|
@ -562,6 +564,10 @@ class MediaDecoder : public DecoderDoctorLifeLogger<MediaDecoder> {
|
||||||
// disabled.
|
// disabled.
|
||||||
bool mHasSuspendTaint;
|
bool mHasSuspendTaint;
|
||||||
|
|
||||||
|
// True if the decoder is sending video to a secondary container, and should
|
||||||
|
// not suspend the decoder.
|
||||||
|
bool mIsCloningVisually;
|
||||||
|
|
||||||
MediaDecoderOwner::NextFrameStatus mNextFrameStatus =
|
MediaDecoderOwner::NextFrameStatus mNextFrameStatus =
|
||||||
MediaDecoderOwner::NEXT_FRAME_UNAVAILABLE;
|
MediaDecoderOwner::NEXT_FRAME_UNAVAILABLE;
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче