Add support for media recorders in Camera1Capturer.
BUG=b/36684011 Review-Url: https://codereview.webrtc.org/2861893003 Cr-Commit-Position: refs/heads/master@{#18024}
This commit is contained in:
@ -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
|
||||
|
||||
Reference in New Issue
Block a user