Bug 1404977 - Exit NotifyInputData early if there's no input listener. r?achronop draft
authorAndreas Pehrson <apehrson@mozilla.com>
Fri, 03 Aug 2018 14:14:36 +0200
changeset 826300 22ba8e67ad3d2423dfc4cc5b7958889ba4dfba02
parent 826299 1f50722e36b4684fd51b463f230546f1b495cded
push id118279
push userbmo:apehrson@mozilla.com
push dateFri, 03 Aug 2018 12:32:15 +0000
reviewersachronop
bugs1404977
milestone63.0a1
Bug 1404977 - Exit NotifyInputData early if there's no input listener. r?achronop MozReview-Commit-ID: KMy01D2VjLi
dom/media/MediaStreamGraph.cpp
--- a/dom/media/MediaStreamGraph.cpp
+++ b/dom/media/MediaStreamGraph.cpp
@@ -971,16 +971,19 @@ MediaStreamGraphImpl::NotifyInputData(co
   {
     MonitorAutoLock lock(mMonitor);
     // Either we have an audio input device, or we just removed the audio input
     // this iteration, and we're switching back to an output-only driver next
     // iteration.
     MOZ_ASSERT(mInputDeviceID || CurrentDriver()->Switching());
   }
 #endif
+  if (!mInputDeviceID) {
+    return;
+  }
   nsTArray<RefPtr<AudioDataListener>>* listeners = mInputDeviceUsers.GetValue(mInputDeviceID);
   MOZ_ASSERT(listeners);
   for (auto& listener : *listeners) {
     listener->NotifyInputData(this, aBuffer, aFrames, aRate, aChannels);
   }
 }
 
 void MediaStreamGraphImpl::DeviceChangedImpl()