Bug 1438134 - Apply new capability only after stopping capture. r=jib
authorAndreas Pehrson <pehrsons@mozilla.com>
Wed, 14 Feb 2018 12:24:25 +0100
changeset 408487 162cbccb6cc81775a2b061a14f79b1cd8b82c7ff
parent 408486 c1e67066d43711e0aac7e2661538fe5b0f4d9517
child 408488 44e3002709433f4595cd913f9057b0770f380db2
push id33645
push userrgurzau@mozilla.com
push dateFri, 16 Mar 2018 17:49:51 +0000
treeherdermozilla-central@3b10b50a72d7 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjib
bugs1438134
milestone61.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1438134 - Apply new capability only after stopping capture. r=jib MozReview-Commit-ID: 6rtcyFpwxmP
dom/media/webrtc/MediaEngineRemoteVideoSource.cpp
--- a/dom/media/webrtc/MediaEngineRemoteVideoSource.cpp
+++ b/dom/media/webrtc/MediaEngineRemoteVideoSource.cpp
@@ -369,31 +369,34 @@ MediaEngineRemoteVideoSource::Reconfigur
     return NS_ERROR_FAILURE;
   }
   LOG(("ChooseCapability(kFitness) for mTargetCapability (Reconfigure) --"));
 
   if (mCapability == newCapability) {
     return NS_OK;
   }
 
+  bool started = mState == kStarted;
+  if (started) {
+    // Allocate always returns a null AllocationHandle.
+    // We can safely pass nullptr below.
+    nsresult rv = Stop(nullptr);
+    if (NS_WARN_IF(NS_FAILED(rv))) {
+      return rv;
+    }
+  }
+
   {
     MutexAutoLock lock(mMutex);
     // Start() applies mCapability on the device.
     mCapability = newCapability;
   }
 
-  if (mState == kStarted) {
-    // Allocate always returns a null AllocationHandle.
-    // We can safely pass nullptr below.
-    nsresult rv = Stop(nullptr);
-    if (NS_WARN_IF(NS_FAILED(rv))) {
-      return rv;
-    }
-
-    rv = Start(nullptr);
+  if (started) {
+    nsresult rv = Start(nullptr);
     if (NS_WARN_IF(NS_FAILED(rv))) {
       return rv;
     }
   }
 
   return NS_OK;
 }