Revert of Android: Remove VideoCapturer (patchset #2 id:20001 of https://codereview.webrtc.org/1684403002/ )
Reason for revert: Breaks downstream compilation. Please reland in a non-breaking fashion. Original issue's description: > Android: Remove VideoCapturer > > This CL makes PeerConnectionFactory.createVideoSource() and nativeCreateVideoSource work directly with VideoCapturerAndroid instead of going via VideoCapturer. The native part is now created in nativeCreateVideoSource() instead of doing it immediately in VideoCapturerAndroid.create(). > > BUG=webrtc:5519 > R=perkj@webrtc.org > > Committed: https://crrev.com/09eab315fddc3432c19d8f662f4b9360f2a58010 > Cr-Commit-Position: refs/heads/master@{#11582} TBR=perkj@webrtc.org,magjed@webrtc.org # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=webrtc:5519 Review URL: https://codereview.webrtc.org/1690073002 Cr-Commit-Position: refs/heads/master@{#11586}
This commit is contained in:
@ -45,7 +45,7 @@ import java.util.concurrent.TimeUnit;
|
||||
// camera thread. The internal *OnCameraThread() methods must check |camera| for null to check if
|
||||
// the camera has been stopped.
|
||||
@SuppressWarnings("deprecation")
|
||||
public class VideoCapturerAndroid implements
|
||||
public class VideoCapturerAndroid extends VideoCapturer implements
|
||||
android.hardware.Camera.PreviewCallback,
|
||||
SurfaceTextureHelper.OnTextureFrameAvailableListener {
|
||||
private final static String TAG = "VideoCapturerAndroid";
|
||||
@ -196,7 +196,12 @@ public class VideoCapturerAndroid implements
|
||||
if (cameraId == -1) {
|
||||
return null;
|
||||
}
|
||||
return new VideoCapturerAndroid(cameraId, eventsHandler, sharedEglContext);
|
||||
|
||||
final VideoCapturerAndroid capturer = new VideoCapturerAndroid(cameraId, eventsHandler,
|
||||
sharedEglContext);
|
||||
capturer.setNativeCapturer(
|
||||
nativeCreateVideoCapturer(capturer, capturer.surfaceHelper));
|
||||
return capturer;
|
||||
}
|
||||
|
||||
public void printStackTrace() {
|
||||
@ -297,6 +302,11 @@ public class VideoCapturerAndroid implements
|
||||
return CameraEnumerationAndroid.getSupportedFormatsAsJson(getCurrentCameraId());
|
||||
}
|
||||
|
||||
// Called from native VideoCapturer_nativeCreateVideoCapturer.
|
||||
private VideoCapturerAndroid(int cameraId) {
|
||||
this(cameraId, null, null);
|
||||
}
|
||||
|
||||
private VideoCapturerAndroid(int cameraId, CameraEventsHandler eventsHandler,
|
||||
EglBase.Context sharedContext) {
|
||||
this.id = cameraId;
|
||||
@ -337,9 +347,9 @@ public class VideoCapturerAndroid implements
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Quits the camera thread. This needs to be done manually, otherwise the thread and handler will
|
||||
// not be garbage collected.
|
||||
public void release() {
|
||||
// Called by native code to quit the camera thread. This needs to be done manually, otherwise the
|
||||
// thread and handler will not be garbage collected.
|
||||
private void release() {
|
||||
Logging.d(TAG, "release");
|
||||
if (isReleased()) {
|
||||
throw new IllegalStateException("Already released");
|
||||
@ -759,4 +769,8 @@ public class VideoCapturerAndroid implements
|
||||
private native void nativeOnOutputFormatRequest(long nativeCapturer,
|
||||
int width, int height, int framerate);
|
||||
}
|
||||
|
||||
private static native long nativeCreateVideoCapturer(
|
||||
VideoCapturerAndroid videoCapturer,
|
||||
SurfaceTextureHelper surfaceHelper);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user