Bug 1636515 - Handle cycle in media element when it is fed with the captured stream. r=padenot

Feeding a media element with the captured stream from the same media element does not make sense. Currently the spec does not mention anything about it. I'll clarify the case in the spec. In the meantime, when a cycle is detected, the setting of the `srcObject` is ignored and a warning is produced in the console.

Differential Revision: https://phabricator.services.mozilla.com/D76821
This commit is contained in:
Alex Chronopoulos
2020-05-28 13:07:53 +00:00
parent 90773e914b
commit 8dd0131c38
2 changed files with 9 additions and 0 deletions

View File

@@ -2089,6 +2089,13 @@ void HTMLMediaElement::SetSrcObject(DOMMediaStream& aValue) {
}
void HTMLMediaElement::SetSrcObject(DOMMediaStream* aValue) {
for (auto& outputStream : mOutputStreams) {
if (aValue == outputStream.mStream) {
ReportToConsole(nsIScriptError::warningFlag,
"MediaElementStreamCaptureCycle");
return;
}
}
mSrcAttrStream = aValue;
UpdateAudioChannelPlayingState();
DoLoad();