Bug 1592539 - Make MediaStreamRenderer always apply its FirstFrameVideoOutput. r=jib,karlt

The first-frame output used to only be applied when not rendering the
MediaStream, and the regular video output was applied when rendering.

The difference with this patch is when rendering -- both the first-frame and the
regular outputs are applied at the same time. The former allows one frame to go
through to the VideoFrameContainer, then the regular output takes over and lets
any frames through. Nothing in how frames are rendered should be noticable by
users.

This allows for simpler logic for resolving the visual clone target promise in a
future patch, as we won't have to track the first frame in different outputs
depending on the rendering state.

Differential Revision: https://phabricator.services.mozilla.com/D87138
This commit is contained in:
Andreas Pehrson 2020-08-26 14:25:27 +00:00
Родитель f1fcc6692b
Коммит 2a5941ee11
1 изменённых файлов: 9 добавлений и 12 удалений

Просмотреть файл

@ -856,10 +856,6 @@ class HTMLMediaElement::MediaStreamRenderer
}
if (mVideoTrack) {
if (mFirstFrameVideoOutput) {
mVideoTrack->AsVideoStreamTrack()->RemoveVideoOutput(
mFirstFrameVideoOutput);
}
mVideoTrack->AsVideoStreamTrack()->AddVideoOutput(mVideoContainer);
}
}
@ -883,10 +879,6 @@ class HTMLMediaElement::MediaStreamRenderer
if (mVideoTrack) {
mVideoTrack->AsVideoStreamTrack()->RemoveVideoOutput(mVideoContainer);
if (mFirstFrameVideoOutput) {
mVideoTrack->AsVideoStreamTrack()->AddVideoOutput(
mFirstFrameVideoOutput);
}
}
}
@ -958,10 +950,14 @@ class HTMLMediaElement::MediaStreamRenderer
}
mVideoTrack = aTrack;
EnsureGraphTimeDummy();
if (mFirstFrameVideoOutput) {
// Add the first frame output even if we are rendering. It will only
// accept one frame. If we are rendering, then the main output will
// overwrite that with the same frame (and possibly more frames).
aTrack->AddVideoOutput(mFirstFrameVideoOutput);
}
if (mRendering) {
aTrack->AddVideoOutput(mVideoContainer);
} else if (mFirstFrameVideoOutput) {
aTrack->AddVideoOutput(mFirstFrameVideoOutput);
}
}
@ -977,10 +973,11 @@ class HTMLMediaElement::MediaStreamRenderer
if (!mVideoContainer) {
return;
}
if (mFirstFrameVideoOutput) {
aTrack->RemoveVideoOutput(mFirstFrameVideoOutput);
}
if (mRendering) {
aTrack->RemoveVideoOutput(mVideoContainer);
} else if (mFirstFrameVideoOutput) {
aTrack->RemoveVideoOutput(mFirstFrameVideoOutput);
}
mVideoTrack = nullptr;
}