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

Unified Diff: webrtc/sdk/android/src/java/org/webrtc/Camera1Session.java

Issue 2861893003: Add support for media recorders in Camera1Capturer. (Closed)
Patch Set: Created 3 years, 7 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 | « webrtc/sdk/android/instrumentationtests/src/org/webrtc/CameraVideoCapturerTestFixtures.java ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/sdk/android/src/java/org/webrtc/Camera1Session.java
diff --git a/webrtc/sdk/android/src/java/org/webrtc/Camera1Session.java b/webrtc/sdk/android/src/java/org/webrtc/Camera1Session.java
index 77faa508c4d3549a489b1c5d76975833805bf02e..d1950690c34f7f1b10a413e6ab1ca17a42621088 100644
--- a/webrtc/sdk/android/src/java/org/webrtc/Camera1Session.java
+++ b/webrtc/sdk/android/src/java/org/webrtc/Camera1Session.java
@@ -11,6 +11,7 @@
package org.webrtc;
import android.content.Context;
+import android.media.MediaRecorder;
import android.os.Handler;
import android.os.SystemClock;
import android.view.Surface;
@@ -52,8 +53,8 @@ class Camera1Session implements CameraSession {
public static void create(final CreateSessionCallback callback, final Events events,
final boolean captureToTexture, final Context applicationContext,
- final SurfaceTextureHelper surfaceTextureHelper, final int cameraId, final int width,
- final int height, final int framerate) {
+ final SurfaceTextureHelper surfaceTextureHelper, final MediaRecorder mediaRecorder,
+ final int cameraId, final int width, final int height, final int framerate) {
final long constructionTimeNs = System.nanoTime();
Logging.d(TAG, "Open camera " + cameraId);
events.onCameraOpening();
@@ -96,8 +97,9 @@ class Camera1Session implements CameraSession {
// Calculate orientation manually and send it as CVO insted.
camera.setDisplayOrientation(0 /* degrees */);
- callback.onDone(new Camera1Session(events, captureToTexture, applicationContext,
- surfaceTextureHelper, cameraId, camera, info, captureFormat, constructionTimeNs));
+ callback.onDone(
+ new Camera1Session(events, captureToTexture, applicationContext, surfaceTextureHelper,
+ mediaRecorder, cameraId, camera, info, captureFormat, constructionTimeNs));
}
private static void updateCameraParameters(android.hardware.Camera camera,
@@ -145,9 +147,9 @@ class Camera1Session implements CameraSession {
}
private Camera1Session(Events events, boolean captureToTexture, Context applicationContext,
- SurfaceTextureHelper surfaceTextureHelper, int cameraId, android.hardware.Camera camera,
- android.hardware.Camera.CameraInfo info, CaptureFormat captureFormat,
- long constructionTimeNs) {
+ SurfaceTextureHelper surfaceTextureHelper, MediaRecorder mediaRecorder, int cameraId,
+ android.hardware.Camera camera, android.hardware.Camera.CameraInfo info,
+ CaptureFormat captureFormat, long constructionTimeNs) {
Logging.d(TAG, "Create new camera1 session on camera " + cameraId);
this.cameraThreadHandler = new Handler();
@@ -162,6 +164,11 @@ class Camera1Session implements CameraSession {
this.constructionTimeNs = constructionTimeNs;
startCapturing();
+
+ if (mediaRecorder != null) {
+ camera.unlock();
+ mediaRecorder.setCamera(camera);
+ }
}
@Override
« no previous file with comments | « webrtc/sdk/android/instrumentationtests/src/org/webrtc/CameraVideoCapturerTestFixtures.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698