Android: Remove video recording functionality from the camera classes
There was an attempt to add MediaRecording functionality to the camera classes, but it was never finished and never worked properly. This CL removes the code for it. In the future, if offline video recording is needed we should add it as a VideoSink instead of inside the camera classes. Bug: webrtc:9144 Change-Id: I74b70d4b128aa212d84e70da01e5e19133c5af24 Reviewed-on: https://webrtc-review.googlesource.com/69642 Reviewed-by: Sami Kalliomäki <sakal@webrtc.org> Commit-Queue: Magnus Jedvert <magjed@webrtc.org> Cr-Commit-Position: refs/heads/master@{#23050}
This commit is contained in:

committed by
Commit Bot

parent
6a8f30e5a3
commit
5ebb82ba9c
@ -22,13 +22,12 @@ import android.hardware.camera2.CameraManager;
|
||||
import android.hardware.camera2.CameraMetadata;
|
||||
import android.hardware.camera2.CaptureFailure;
|
||||
import android.hardware.camera2.CaptureRequest;
|
||||
import android.media.MediaRecorder;
|
||||
import android.os.Handler;
|
||||
import javax.annotation.Nullable;
|
||||
import android.util.Range;
|
||||
import android.view.Surface;
|
||||
import android.view.WindowManager;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import org.webrtc.CameraEnumerationAndroid.CaptureFormat;
|
||||
@ -52,7 +51,6 @@ class Camera2Session implements CameraSession {
|
||||
private final Context applicationContext;
|
||||
private final CameraManager cameraManager;
|
||||
private final SurfaceTextureHelper surfaceTextureHelper;
|
||||
@Nullable private final Surface mediaRecorderSurface;
|
||||
private final String cameraId;
|
||||
private final int width;
|
||||
private final int height;
|
||||
@ -127,14 +125,9 @@ class Camera2Session implements CameraSession {
|
||||
final SurfaceTexture surfaceTexture = surfaceTextureHelper.getSurfaceTexture();
|
||||
surfaceTexture.setDefaultBufferSize(captureFormat.width, captureFormat.height);
|
||||
surface = new Surface(surfaceTexture);
|
||||
List<Surface> surfaces = new ArrayList<Surface>();
|
||||
surfaces.add(surface);
|
||||
if (mediaRecorderSurface != null) {
|
||||
Logging.d(TAG, "Add MediaRecorder surface to capture session.");
|
||||
surfaces.add(mediaRecorderSurface);
|
||||
}
|
||||
try {
|
||||
camera.createCaptureSession(surfaces, new CaptureSessionCallback(), cameraThreadHandler);
|
||||
camera.createCaptureSession(
|
||||
Arrays.asList(surface), new CaptureSessionCallback(), cameraThreadHandler);
|
||||
} catch (CameraAccessException e) {
|
||||
reportError("Failed to create capture session. " + e);
|
||||
return;
|
||||
@ -184,10 +177,6 @@ class Camera2Session implements CameraSession {
|
||||
chooseFocusMode(captureRequestBuilder);
|
||||
|
||||
captureRequestBuilder.addTarget(surface);
|
||||
if (mediaRecorderSurface != null) {
|
||||
Logging.d(TAG, "Add MediaRecorder surface to CaptureRequest.Builder");
|
||||
captureRequestBuilder.addTarget(mediaRecorderSurface);
|
||||
}
|
||||
session.setRepeatingRequest(
|
||||
captureRequestBuilder.build(), new CameraCaptureCallback(), cameraThreadHandler);
|
||||
} catch (CameraAccessException e) {
|
||||
@ -297,16 +286,15 @@ class Camera2Session implements CameraSession {
|
||||
|
||||
public static void create(CreateSessionCallback callback, Events events,
|
||||
Context applicationContext, CameraManager cameraManager,
|
||||
SurfaceTextureHelper surfaceTextureHelper, MediaRecorder mediaRecorder, String cameraId,
|
||||
int width, int height, int framerate) {
|
||||
SurfaceTextureHelper surfaceTextureHelper, String cameraId, int width, int height,
|
||||
int framerate) {
|
||||
new Camera2Session(callback, events, applicationContext, cameraManager, surfaceTextureHelper,
|
||||
mediaRecorder, cameraId, width, height, framerate);
|
||||
cameraId, width, height, framerate);
|
||||
}
|
||||
|
||||
private Camera2Session(CreateSessionCallback callback, Events events, Context applicationContext,
|
||||
CameraManager cameraManager, SurfaceTextureHelper surfaceTextureHelper,
|
||||
@Nullable MediaRecorder mediaRecorder, String cameraId, int width, int height,
|
||||
int framerate) {
|
||||
CameraManager cameraManager, SurfaceTextureHelper surfaceTextureHelper, String cameraId,
|
||||
int width, int height, int framerate) {
|
||||
Logging.d(TAG, "Create new camera2 session on camera " + cameraId);
|
||||
|
||||
constructionTimeNs = System.nanoTime();
|
||||
@ -317,7 +305,6 @@ class Camera2Session implements CameraSession {
|
||||
this.applicationContext = applicationContext;
|
||||
this.cameraManager = cameraManager;
|
||||
this.surfaceTextureHelper = surfaceTextureHelper;
|
||||
this.mediaRecorderSurface = (mediaRecorder != null) ? mediaRecorder.getSurface() : null;
|
||||
this.cameraId = cameraId;
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
|
Reference in New Issue
Block a user