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

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

Issue 2357893002: Reland of Release camera statistics after switching camera on CameraCapturer. (Closed)
Patch Set: Create camera statistics before calling any callbacks and don't set switch as pending on stopped ca… 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/api/android/java/src/org/webrtc/CameraCapturer.java
diff --git a/webrtc/api/android/java/src/org/webrtc/CameraCapturer.java b/webrtc/api/android/java/src/org/webrtc/CameraCapturer.java
index be57a9bd7fd4e91c4147ac0c6cafdb84dfdf807c..e0ce19d42a005af694662bd67e985773a3b92660 100644
--- a/webrtc/api/android/java/src/org/webrtc/CameraCapturer.java
+++ b/webrtc/api/android/java/src/org/webrtc/CameraCapturer.java
@@ -44,6 +44,8 @@ public abstract class CameraCapturer implements CameraVideoCapturer {
synchronized (stateLock) {
sessionOpening = false;
currentSession = session;
+ cameraStatistics = new CameraStatistics(surfaceHelper, eventsHandler);
+ firstFrameObserved = false;
stateLock.notifyAll();
if (switchState == SwitchState.IN_PROGRESS) {
@@ -57,9 +59,6 @@ public abstract class CameraCapturer implements CameraVideoCapturer {
switchState = SwitchState.IDLE;
switchCameraInternal(switchEventsHandler);
}
-
- cameraStatistics = new CameraStatistics(surfaceHelper, eventsHandler);
- firstFrameObserved = false;
}
}
@@ -379,6 +378,14 @@ public abstract class CameraCapturer implements CameraVideoCapturer {
return;
}
+ if (!sessionOpening && currentSession == null) {
+ Logging.d(TAG, "switchCamera: No session open");
+ if (switchEventsHandler != null) {
+ switchEventsHandler.onCameraSwitchError("Camera is not running.");
+ }
+ return;
+ }
+
this.switchEventsHandler = switchEventsHandler;
if (sessionOpening) {
switchState = SwitchState.PENDING;
@@ -387,15 +394,9 @@ public abstract class CameraCapturer implements CameraVideoCapturer {
switchState = SwitchState.IN_PROGRESS;
}
- if (currentSession == null) {
- Logging.d(TAG, "switchCamera: No session open");
- if (switchEventsHandler != null) {
- switchEventsHandler.onCameraSwitchError("Camera is not running.");
- }
- return;
- }
-
Logging.d(TAG, "switchCamera: Stopping session");
+ cameraStatistics.release();
+ cameraStatistics = null;
currentSession.stop();
currentSession = null;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698