Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(881)

Unified Diff: webrtc/api/android/java/src/org/webrtc/Camera2Session.java

Issue 2381343002: Add onCameraDisconnected camera event. (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webrtc/api/android/java/src/org/webrtc/Camera2Session.java
diff --git a/webrtc/api/android/java/src/org/webrtc/Camera2Session.java b/webrtc/api/android/java/src/org/webrtc/Camera2Session.java
index 6ff73c5aedb18d47d1241d8a60a875356260ec5f..ad4ffd69b11a29a6b03b97cfb730eacd70b7a33c 100644
--- a/webrtc/api/android/java/src/org/webrtc/Camera2Session.java
+++ b/webrtc/api/android/java/src/org/webrtc/Camera2Session.java
@@ -98,7 +98,14 @@ public class Camera2Session implements CameraSession {
@Override
public void onDisconnected(CameraDevice camera) {
checkIsOnCameraThread();
- reportError("Camera disconnected.");
+ final boolean startFailure = (captureSession == null);
+ state = SessionState.STOPPED;
+ stopInternal();
+ if (startFailure) {
+ callback.onFailure("Camera disconnected / evicted.");
+ } else {
+ events.onCameraDisconnected(Camera2Session.this);
+ }
}
@Override
« no previous file with comments | « webrtc/api/android/java/src/org/webrtc/Camera1Session.java ('k') | webrtc/api/android/java/src/org/webrtc/CameraCapturer.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698