From 1ae6a459868917c8c2bb3cc8080192abc4f4bbb2 Mon Sep 17 00:00:00 2001 From: Magnus Jedvert Date: Tue, 8 Mar 2016 20:38:07 +0100 Subject: [PATCH] Android VideoCapturerAndroid: Move stopListening() call to stopCaptureOnCameraThread() switchCamera() only calls stopCaptureOnCameraThread(), not stopCapture(), so the stopListening() call must be placed there. BUG=webrtc:5519,b/27497950 R=perkj@webrtc.org Review URL: https://codereview.webrtc.org/1770423002 . Cr-Commit-Position: refs/heads/master@{#11917} --- webrtc/api/java/android/org/webrtc/VideoCapturerAndroid.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/webrtc/api/java/android/org/webrtc/VideoCapturerAndroid.java b/webrtc/api/java/android/org/webrtc/VideoCapturerAndroid.java index 75a0c3e9d1..5c9b77b4cc 100644 --- a/webrtc/api/java/android/org/webrtc/VideoCapturerAndroid.java +++ b/webrtc/api/java/android/org/webrtc/VideoCapturerAndroid.java @@ -544,8 +544,6 @@ public class VideoCapturerAndroid implements final CountDownLatch barrier = new CountDownLatch(1); cameraThreadHandler.post(new Runnable() { @Override public void run() { - // Make sure onTextureFrameAvailable() is not called anymore. - surfaceHelper.stopListening(); stopCaptureOnCameraThread(); barrier.countDown(); } @@ -566,6 +564,8 @@ public class VideoCapturerAndroid implements return; } + // Make sure onTextureFrameAvailable() is not called anymore. + surfaceHelper.stopListening(); cameraThreadHandler.removeCallbacks(cameraObserver); cameraStatistics.getAndResetFrameCount(); Logging.d(TAG, "Stop preview.");