Bug 1047121: Release Window-capture VideoEngine when done; clean up shutdown code r=cpearce a=sylvestre
authorRandell Jesup <rjesup@jesup.org>
Sat, 02 Aug 2014 00:30:51 -0400
changeset 217394 b2e3d8e9ea6c52baa4b248860cba0895c9d7c320
parent 217393 010d01a4c0a3b0ab6c029cdbebef4c7174c054af
child 217395 d09fe5c4d537ba696bc3df98fcb641e3b5b523b8
push id515
push userraliiev@mozilla.com
push dateMon, 06 Oct 2014 12:51:51 +0000
treeherdermozilla-release@267c7a481bef [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerscpearce, sylvestre
bugs1047121
milestone33.0a2
Bug 1047121: Release Window-capture VideoEngine when done; clean up shutdown code r=cpearce a=sylvestre
content/media/webrtc/MediaEngineWebRTC.cpp
--- a/content/media/webrtc/MediaEngineWebRTC.cpp
+++ b/content/media/webrtc/MediaEngineWebRTC.cpp
@@ -363,38 +363,45 @@ MediaEngineWebRTC::EnumerateAudioDevices
 
 void
 MediaEngineWebRTC::Shutdown()
 {
   // This is likely paranoia
   MutexAutoLock lock(mMutex);
 
   // Clear callbacks before we go away since the engines may outlive us
+  mVideoSources.Clear();
+  mAudioSources.Clear();
   if (mVideoEngine) {
-    mVideoSources.Clear();
     mVideoEngine->SetTraceCallback(nullptr);
     webrtc::VideoEngine::Delete(mVideoEngine);
   }
 
   if (mScreenEngine) {
+    mScreenEngine->SetTraceCallback(nullptr);
     webrtc::VideoEngine::Delete(mScreenEngine);
   }
+  if (mWinEngine) {
+    mWinEngine->SetTraceCallback(nullptr);
+    webrtc::VideoEngine::Delete(mWinEngine);
+  }
   if (mAppEngine) {
+    mBrowserEngine->SetTraceCallback(nullptr);
     webrtc::VideoEngine::Delete(mAppEngine);
   }
 
   if (mVoiceEngine) {
-    mAudioSources.Clear();
     mVoiceEngine->SetTraceCallback(nullptr);
     webrtc::VoiceEngine::Delete(mVoiceEngine);
   }
 
   mVideoEngine = nullptr;
   mVoiceEngine = nullptr;
   mScreenEngine = nullptr;
+  mWinEngine = nullptr;
   mAppEngine = nullptr;
 
   if (mThread) {
     mThread->Shutdown();
     mThread = nullptr;
   }
 }