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

Unified Diff: webrtc/api/java/android/org/webrtc/VideoCapturerAndroid.java

Issue 1690073002: Revert of Android: Remove VideoCapturer (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 10 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
Index: webrtc/api/java/android/org/webrtc/VideoCapturerAndroid.java
diff --git a/webrtc/api/java/android/org/webrtc/VideoCapturerAndroid.java b/webrtc/api/java/android/org/webrtc/VideoCapturerAndroid.java
index b539f125c0f9e7b62455430307a6c79d2caf2d6e..5edca3b83cc04427df7aea656d8ec9a9f40596d8 100644
--- a/webrtc/api/java/android/org/webrtc/VideoCapturerAndroid.java
+++ b/webrtc/api/java/android/org/webrtc/VideoCapturerAndroid.java
@@ -45,7 +45,7 @@
// 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 @@
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() {
@@ -295,6 +300,11 @@
// Called from native code.
private String getSupportedFormatsAsJson() throws JSONException {
return CameraEnumerationAndroid.getSupportedFormatsAsJson(getCurrentCameraId());
+ }
+
+ // Called from native VideoCapturer_nativeCreateVideoCapturer.
+ private VideoCapturerAndroid(int cameraId) {
+ this(cameraId, null, null);
}
private VideoCapturerAndroid(int cameraId, CameraEventsHandler eventsHandler,
@@ -337,9 +347,9 @@
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 @@
private native void nativeOnOutputFormatRequest(long nativeCapturer,
int width, int height, int framerate);
}
+
+ private static native long nativeCreateVideoCapturer(
+ VideoCapturerAndroid videoCapturer,
+ SurfaceTextureHelper surfaceHelper);
}

Powered by Google App Engine
This is Rietveld 408576698