Bug 1440255 - Backout bug 1420585 deadlock wallpaper fix r=dminor
authorAndreas Pehrson <pehrsons@mozilla.com>
Thu, 05 Apr 2018 11:55:26 +0200
changeset 411984 010d3951685d72b3d5f52bfb85c0433fcfeaa461
parent 411983 9cc46ceede5917930db2d560ce0330cc9720a60d
child 411985 f4d6d91cd3509485ad4336609c081b77e3f7244b
push id33778
push userapavel@mozilla.com
push dateFri, 06 Apr 2018 09:57:38 +0000
treeherdermozilla-central@46a5fc19bd7a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdminor
bugs1440255, 1420585
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 1440255 - Backout bug 1420585 deadlock wallpaper fix r=dminor MozReview-Commit-ID: DurGH2RmXQH
media/webrtc/trunk/webrtc/modules/video_capture/android/java/src/org/webrtc/videoengine/VideoCaptureAndroid.java
--- a/media/webrtc/trunk/webrtc/modules/video_capture/android/java/src/org/webrtc/videoengine/VideoCaptureAndroid.java
+++ b/media/webrtc/trunk/webrtc/modules/video_capture/android/java/src/org/webrtc/videoengine/VideoCaptureAndroid.java
@@ -267,23 +267,21 @@ public class VideoCaptureAndroid impleme
       averageDurationMs = 1000000.0f / (max_mfps / frameDropRatio);
       camera.startPreview();
       exchange(result, true);
       return;
     } catch (RuntimeException e) {
       error = e;
     }
     Log.e(TAG, "startCapture failed", error);
-    // For some devices, camera.setParameters(parameters) would throw
-    // an exception when a specific resolution is set. Originally,
-    // stopCaptureOnCameraThread() is called here to clear up the state.
-    // However, stopCaptureOnCameraThread(), which uses Exchanger to
-    // synchronize and swap data with MediaManager thread, is supposed to be
-    // called by MediaManager thread like we did at stopCapture(). Calling
-    // this function directly in CameraThread will cause deadlock.
+    if (camera != null) {
+      Exchanger<Boolean> resultDropper = new Exchanger<Boolean>();
+      stopCaptureOnCameraThread(resultDropper);
+      exchange(resultDropper, false);
+    }
     exchange(result, false);
     return;
   }
 
   // Called by native code.  Returns true when camera is known to be stopped.
   @WebRTCJNITarget
   private synchronized boolean stopCapture() {
     Log.d(TAG, "stopCapture");