Bug 1319566: ensure all registered handles are cleared properly r=padenot
authorRandell Jesup <rjesup@jesup.org>
Wed, 30 Nov 2016 18:25:53 -0500
changeset 324887 69bdb4f40c1e4d66c4bc17280b119b157cc77c0e
parent 324886 24af599c0e9b4f438cf728355af25547cc33b2d1
child 324888 cd4cdcc9ad6c45dad8b8d8c0d40e459db2bca8a1
child 324948 a5a5b7e56cba2f5e641943c2c9a6a6239c807be5
push id24
push usermaklebus@msu.edu
push dateTue, 20 Dec 2016 03:11:33 +0000
reviewerspadenot
bugs1319566
milestone53.0a1
Bug 1319566: ensure all registered handles are cleared properly r=padenot
dom/media/webrtc/MediaEngineWebRTCAudio.cpp
--- a/dom/media/webrtc/MediaEngineWebRTCAudio.cpp
+++ b/dom/media/webrtc/MediaEngineWebRTCAudio.cpp
@@ -809,20 +809,21 @@ MediaEngineWebRTCMicrophoneSource::Shutd
       }
       Stop(source, kAudioTrack); // XXX change to support multiple tracks
     }
     MOZ_ASSERT(mState == kStopped);
   }
 
   while (mRegisteredHandles.Length()) {
     MOZ_ASSERT(mState == kAllocated || mState == kStopped);
-    Deallocate(nullptr); // XXX Extend concurrent constraints code to mics.
+    // on last Deallocate(), FreeChannel()s and DeInit()s if all channels are released
+    Deallocate(mRegisteredHandles[0].get());
   }
+  MOZ_ASSERT(mState == kReleased);
 
-  FreeChannel();
   mAudioInput = nullptr;
 }
 
 typedef int16_t sample;
 
 void
 MediaEngineWebRTCMicrophoneSource::Process(int channel,
                                            webrtc::ProcessingTypes type,