From c117e2ed79bf1a354bd611c761fd621a80058d72 Mon Sep 17 00:00:00 2001 From: sakal Date: Mon, 16 Jan 2017 09:40:36 -0800 Subject: [PATCH] Do not classify error after stopping the camera as a startup failure. Calling event handlers when the camera is closing is safe because CameraCapturer checks if the errors are coming from the current session. Calling onFailure after camera has already started might lead to strange behavior. BUG=b/34112992 Review-Url: https://codereview.webrtc.org/2634973002 Cr-Commit-Position: refs/heads/master@{#16101} --- webrtc/sdk/android/api/org/webrtc/Camera2Session.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/webrtc/sdk/android/api/org/webrtc/Camera2Session.java b/webrtc/sdk/android/api/org/webrtc/Camera2Session.java index 2552b2413e..a8e992d802 100644 --- a/webrtc/sdk/android/api/org/webrtc/Camera2Session.java +++ b/webrtc/sdk/android/api/org/webrtc/Camera2Session.java @@ -97,7 +97,7 @@ public class Camera2Session implements CameraSession { @Override public void onDisconnected(CameraDevice camera) { checkIsOnCameraThread(); - final boolean startFailure = (captureSession == null); + final boolean startFailure = (captureSession == null) && (state != SessionState.STOPPED); state = SessionState.STOPPED; stopInternal(); if (startFailure) { @@ -402,7 +402,7 @@ public class Camera2Session implements CameraSession { checkIsOnCameraThread(); Logging.e(TAG, "Error: " + error); - final boolean startFailure = (captureSession == null); + final boolean startFailure = (captureSession == null) && (state != SessionState.STOPPED); state = SessionState.STOPPED; stopInternal(); if (startFailure) {