Bug 1329075 - Avoid an infinite event loop spin. r=jesup
Because we add tracks to the output streams async, it's possible to switch the mSrcStream of a media element and *then* get a notification of an added track, when this track originated from the old mSrcStream. If the new mSrcStream is an output stream of the media element, this would again add a new track async, which on the next event loop spin would show up on mSrcStream, and the loop continues. MozReview-Commit-ID: HmKgXLYmubh
This commit is contained in:
@@ -3150,6 +3150,12 @@ HTMLMediaElement::AddCaptureMediaTrackToOutputStream(MediaTrack* aTrack,
|
||||
}
|
||||
aOutputStream.mCapturingMediaStream = true;
|
||||
|
||||
if (aOutputStream.mStream == mSrcStream) {
|
||||
// Cycle detected. This can happen since tracks are added async.
|
||||
// We avoid forwarding it to the output here or we'd get into an infloop.
|
||||
return;
|
||||
}
|
||||
|
||||
MediaStream* outputSource = aOutputStream.mStream->GetInputStream();
|
||||
if (!outputSource) {
|
||||
NS_ERROR("No output source stream");
|
||||
|
||||
Reference in New Issue
Block a user