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:
Magnus Jedvert
2018-04-12 16:23:34 +02:00
committed by Commit Bot
parent 6a8f30e5a3
commit 5ebb82ba9c
10 changed files with 41 additions and 304 deletions

View File

@ -11,7 +11,6 @@
package org.webrtc;
import android.content.Context;
import android.media.MediaRecorder;
import javax.annotation.Nullable;
public class Camera1Capturer extends CameraCapturer {
@ -27,10 +26,10 @@ public class Camera1Capturer extends CameraCapturer {
@Override
protected void createCameraSession(CameraSession.CreateSessionCallback createSessionCallback,
CameraSession.Events events, Context applicationContext,
SurfaceTextureHelper surfaceTextureHelper, @Nullable MediaRecorder mediaRecorder,
String cameraName, int width, int height, int framerate) {
Camera1Session.create(createSessionCallback, events,
captureToTexture || (mediaRecorder != null), applicationContext, surfaceTextureHelper,
mediaRecorder, Camera1Enumerator.getCameraIndex(cameraName), width, height, framerate);
SurfaceTextureHelper surfaceTextureHelper, String cameraName, int width, int height,
int framerate) {
Camera1Session.create(createSessionCallback, events, captureToTexture, applicationContext,
surfaceTextureHelper, Camera1Enumerator.getCameraIndex(cameraName), width, height,
framerate);
}
}

View File

@ -13,7 +13,6 @@ package org.webrtc;
import android.annotation.TargetApi;
import android.content.Context;
import android.hardware.camera2.CameraManager;
import android.media.MediaRecorder;
import javax.annotation.Nullable;
@TargetApi(21)
@ -31,9 +30,9 @@ public class Camera2Capturer extends CameraCapturer {
@Override
protected void createCameraSession(CameraSession.CreateSessionCallback createSessionCallback,
CameraSession.Events events, Context applicationContext,
SurfaceTextureHelper surfaceTextureHelper, MediaRecorder mediaRecoder, String cameraName,
int width, int height, int framerate) {
SurfaceTextureHelper surfaceTextureHelper, String cameraName, int width, int height,
int framerate) {
Camera2Session.create(createSessionCallback, events, applicationContext, cameraManager,
surfaceTextureHelper, mediaRecoder, cameraName, width, height, framerate);
surfaceTextureHelper, cameraName, width, height, framerate);
}
}

View File

@ -67,6 +67,7 @@ public interface CameraVideoCapturer extends VideoCapturer {
* addMediaRecorderToCamera() or removeMediaRecorderFromCamera calls.
* The callback may be called on an arbitrary thread.
*/
@Deprecated
public interface MediaRecorderHandler {
// Invoked on success.
void onMediaRecorderSuccess();
@ -80,13 +81,20 @@ public interface CameraVideoCapturer extends VideoCapturer {
* 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);
@Deprecated
default void addMediaRecorderToCamera(
MediaRecorder mediaRecorder, MediaRecorderHandler resultHandler) {
throw new UnsupportedOperationException("Deprecated and not implemented.");
}
/**
* 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);
@Deprecated
default void removeMediaRecorderFromCamera(MediaRecorderHandler resultHandler) {
throw new UnsupportedOperationException("Deprecated and not implemented.");
}
/**
* Helper class to log framerate and detect if the camera freezes. It will run periodic callbacks