bug 1228484 throw instead of capturing a second stream to a different graph r=roc
authorKarl Tomlinson <karlt+@karlt.net>
Fri, 04 Dec 2015 01:30:46 +1300
changeset 277103 ce9ce7e7d717c912325fa6d25a3fdbe19c4e4124
parent 277102 2c7becfabe070b6d8c383b69868e1927d5310484
child 277104 3a206e2652fc66e9ddea0228c120fa9986ef62b6
push id16724
push usercbook@mozilla.com
push dateMon, 21 Dec 2015 11:00:52 +0000
treeherderfx-team@3f3f0361567c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc
bugs1228484
milestone46.0a1
bug 1228484 throw instead of capturing a second stream to a different graph r=roc
dom/html/HTMLMediaElement.cpp
--- a/dom/html/HTMLMediaElement.cpp
+++ b/dom/html/HTMLMediaElement.cpp
@@ -1878,16 +1878,21 @@ HTMLMediaElement::CaptureStreamInternal(
 
   if (!aGraph) {
     MediaStreamGraph::GraphDriverType graphDriverType =
       HasAudio() ? MediaStreamGraph::AUDIO_THREAD_DRIVER
                  : MediaStreamGraph::SYSTEM_THREAD_DRIVER;
     aGraph = MediaStreamGraph::GetInstance(graphDriverType, mAudioChannel);
   }
 
+  if (!mOutputStreams.IsEmpty() &&
+      aGraph != mOutputStreams[0].mStream->GetInputStream()->Graph()) {
+    return nullptr;
+  }
+
   OutputMediaStream* out = mOutputStreams.AppendElement();
   out->mStream = DOMMediaStream::CreateTrackUnionStream(window, aGraph);
   RefPtr<nsIPrincipal> principal = GetCurrentPrincipal();
   out->mStream->CombineWithPrincipal(principal);
   out->mStream->SetCORSMode(mCORSMode);
   out->mFinishWhenEnded = aFinishWhenEnded;
 
   mAudioCaptured = true;