Bug 1592539 - Inject a FirstFrameVideoOutput into MediaStreamRenderer. r=jib

This allows different users of renderers to inject different first frame
outputs. So far there is only one, but a future patch will bring a special one
for the secondary video frame container.

Differential Revision: https://phabricator.services.mozilla.com/D87137
This commit is contained in:
Andreas Pehrson
2020-08-26 14:25:20 +00:00
parent cc22d15799
commit 02a55ec5a1

View File

@@ -771,14 +771,12 @@ class HTMLMediaElement::MediaStreamRenderer
MediaStreamRenderer(AbstractThread* aMainThread,
VideoFrameContainer* aVideoContainer,
FirstFrameVideoOutput* aFirstFrameVideoOutput,
void* aAudioOutputKey)
: mVideoContainer(aVideoContainer),
mAudioOutputKey(aAudioOutputKey),
mWatchManager(this, aMainThread),
mFirstFrameVideoOutput(aVideoContainer
? MakeAndAddRef<FirstFrameVideoOutput>(
aVideoContainer, aMainThread)
: nullptr) {
mFirstFrameVideoOutput(aFirstFrameVideoOutput) {
if (mFirstFrameVideoOutput) {
mWatchManager.Watch(mFirstFrameVideoOutput->mFirstFrameRendered,
&MediaStreamRenderer::SetFirstFrameRendered);
@@ -5267,8 +5265,13 @@ void HTMLMediaElement::SetupSrcMediaStreamPlayback(DOMMediaStream* aStream) {
mSrcStream = aStream;
VideoFrameContainer* container = GetVideoFrameContainer();
RefPtr<FirstFrameVideoOutput> firstFrameOutput =
container
? MakeAndAddRef<FirstFrameVideoOutput>(container, mAbstractMainThread)
: nullptr;
mMediaStreamRenderer = MakeAndAddRef<MediaStreamRenderer>(
mAbstractMainThread, GetVideoFrameContainer(), this);
mAbstractMainThread, container, firstFrameOutput, this);
mWatchManager.Watch(mPaused,
&HTMLMediaElement::UpdateSrcStreamPotentiallyPlaying);
mWatchManager.Watch(mReadyState,