From 3c82ef78a0d3141958e24649e775641a8cbc8167 Mon Sep 17 00:00:00 2001 From: Munro Mengjue Chiang Date: Fri, 5 Jan 2018 15:50:23 +0800 Subject: [PATCH] Bug 1420585 - remove unnecessary stopCapture which causes deadlock. r=jib MozReview-Commit-ID: F8xcOSPihDN --HG-- extra : rebase_source : 057b77496aa86f9e7f3b4ccd858ec74e8c8453a8 --- .../org/webrtc/videoengine/VideoCaptureAndroid.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git 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 index 3c98a6a514c6..916fb609e0d8 100644 --- 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 @@ -248,11 +248,13 @@ public class VideoCaptureAndroid implements PreviewCallback, Callback { error = e; } Log.e(TAG, "startCapture failed", error); - if (camera != null) { - Exchanger resultDropper = new Exchanger(); - stopCaptureOnCameraThread(resultDropper); - exchange(resultDropper, false); - } + // 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. exchange(result, false); return; }