bug 1228484 throw instead of capturing a second stream to a different graph r=roc a=ritu
authorKarl Tomlinson <karlt+@karlt.net>
Fri, 04 Dec 2015 01:30:46 +1300
changeset 304156 9fa4dbbe3b52cde603f4f34afd1ea702348e122d
parent 304155 0f0e157a12b21f5044b103ffc307d10bad6a4435
child 304157 b474d648a74f821530d735567a870acc9d062bf1
push id5447
push userkwierso@gmail.com
push dateThu, 31 Dec 2015 19:20:49 +0000
treeherdermozilla-beta@d130c7ff6c2f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc, ritu
bugs1228484
milestone44.0
bug 1228484 throw instead of capturing a second stream to a different graph r=roc a=ritu
dom/html/HTMLMediaElement.cpp
--- a/dom/html/HTMLMediaElement.cpp
+++ b/dom/html/HTMLMediaElement.cpp
@@ -1863,16 +1863,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;