Bug 1303419 - Fix nullptr crash in audio gUM. r=drno, a=ritu
☠☠ backed out by 91faf7ec36cd ☠ ☠
authorRandell Jesup <rjesup@jesup.org>
Tue, 20 Sep 2016 15:35:39 -0400
changeset 350333 bc29a87b7aafe77a186051eb8d0b9453d49ce433
parent 350332 88fa08847a2f2825448c5d1121fe21b400080dee
child 350334 4b547741edf0439ea1ef1129615358894e79edf7
push id1230
push userjlund@mozilla.com
push dateMon, 31 Oct 2016 18:13:35 +0000
treeherdermozilla-release@5e06e3766db2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdrno, ritu
bugs1303419
milestone50.0
Bug 1303419 - Fix nullptr crash in audio gUM. r=drno, a=ritu
dom/media/webrtc/MediaEngineWebRTCAudio.cpp
--- a/dom/media/webrtc/MediaEngineWebRTCAudio.cpp
+++ b/dom/media/webrtc/MediaEngineWebRTCAudio.cpp
@@ -815,17 +815,20 @@ MediaEngineWebRTCMicrophoneSource::Shutd
   }
 
   while (mRegisteredHandles.Length()) {
     MOZ_ASSERT(mState == kAllocated || mState == kStopped);
     Deallocate(nullptr); // XXX Extend concurrent constraints code to mics.
   }
 
   FreeChannel();
-  DeInitEngine();
+  MOZ_ASSERT(sChannelsOpen > 0);
+  if (--sChannelsOpen == 0) {
+    DeInitEngine();
+  }
 
   mAudioInput = nullptr;
 }
 
 typedef int16_t sample;
 
 void
 MediaEngineWebRTCMicrophoneSource::Process(int channel,