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

Unified Diff: webrtc/sdk/android/api/org/webrtc/CameraVideoCapturer.java

Issue 2833773003: Support adding and removing MediaRecorder to camera 2 session. (Closed)
Patch Set: Address comments - 3 Created 3 years, 8 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/sdk/android/api/org/webrtc/CameraVideoCapturer.java
diff --git a/webrtc/sdk/android/api/org/webrtc/CameraVideoCapturer.java b/webrtc/sdk/android/api/org/webrtc/CameraVideoCapturer.java
index 283d5d1f2bd55609f461dea4ac124fa4449bfb77..be9d669fc4dfcae3cfd83634a26358c9f746b143 100644
--- a/webrtc/sdk/android/api/org/webrtc/CameraVideoCapturer.java
+++ b/webrtc/sdk/android/api/org/webrtc/CameraVideoCapturer.java
@@ -10,6 +10,8 @@
package org.webrtc;
+import android.media.MediaRecorder;
+
/**
* Base interface for camera1 and camera2 implementations. Extends VideoCapturer with a
* switchCamera() function. Also provides subinterfaces for handling camera events, and a helper
@@ -60,6 +62,32 @@ public interface CameraVideoCapturer extends VideoCapturer {
void switchCamera(CameraSwitchHandler switchEventsHandler);
/**
+ * MediaRecorder add/remove handler - one of these functions are invoked with the result of
+ * addMediaRecorderToCamera() or removeMediaRecorderFromCamera calls.
+ * The callback may be called on an arbitrary thread.
+ */
+ public interface MediaRecorderHandler {
+ // Invoked on success.
+ void onMediaRecorderSuccess();
+
+ // Invoked on failure, e.g. camera is stopped or any exception happens.
+ void onMediaRecorderError(String errorDescription);
+ }
+
+ /**
+ * Add MediaRecorder to camera pipeline. This can only be called while the camera is running.
+ * Once MediaRecorder is added to camera pipeline camera switch is not allowed.
+ * This function can be called from any thread.
+ */
+ void addMediaRecorderToCamera(MediaRecorder mediaRecorder, MediaRecorderHandler resultHandler);
+
+ /**
+ * Remove MediaRecorder from camera pipeline. This can only be called while the camera is running.
+ * This function can be called from any thread.
+ */
+ void removeMediaRecorderFromCamera(MediaRecorderHandler resultHandler);
+
+ /**
* Helper class to log framerate and detect if the camera freezes. It will run periodic callbacks
* on the SurfaceTextureHelper thread passed in the ctor, and should only be operated from that
* thread.

Powered by Google App Engine
This is Rietveld 408576698