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}
diff --git a/webrtc/api/java/jni/peerconnection_jni.cc b/webrtc/api/java/jni/peerconnection_jni.cc
index 236ac71..a19e79a 100644
--- a/webrtc/api/java/jni/peerconnection_jni.cc
+++ b/webrtc/api/java/jni/peerconnection_jni.cc
@@ -910,6 +910,10 @@
CHECK_RELEASE(reinterpret_cast<MediaSourceInterface*>(j_p));
}
+JOW(void, VideoCapturer_free)(JNIEnv*, jclass, jlong j_p) {
+ delete reinterpret_cast<cricket::VideoCapturer*>(j_p);
+}
+
JOW(void, VideoRenderer_freeWrappedVideoRenderer)(JNIEnv*, jclass, jlong j_p) {
delete reinterpret_cast<JavaVideoRendererWrapper*>(j_p);
}
@@ -1212,26 +1216,16 @@
}
JOW(jlong, PeerConnectionFactory_nativeCreateVideoSource)(
- JNIEnv* jni, jclass, jlong native_factory, jobject j_video_capturer,
+ JNIEnv* jni, jclass, jlong native_factory, jlong native_capturer,
jobject j_constraints) {
- // Create a cricket::VideoCapturer from |j_video_capturer|.
- jobject j_surface_texture_helper = GetObjectField(
- jni, j_video_capturer,
- GetFieldID(jni, FindClass(jni, "org/webrtc/VideoCapturerAndroid"),
- "surfaceHelper", "Lorg/webrtc/SurfaceTextureHelper;"));
- rtc::scoped_refptr<webrtc::AndroidVideoCapturerDelegate> delegate =
- new rtc::RefCountedObject<AndroidVideoCapturerJni>(
- jni, j_video_capturer, j_surface_texture_helper);
- rtc::scoped_ptr<cricket::VideoCapturer> capturer(
- new webrtc::AndroidVideoCapturer(delegate));
- // Create a webrtc::VideoSourceInterface from the cricket::VideoCapturer,
- // native factory and constraints.
scoped_ptr<ConstraintsWrapper> constraints(
new ConstraintsWrapper(jni, j_constraints));
rtc::scoped_refptr<PeerConnectionFactoryInterface> factory(
factoryFromJava(native_factory));
rtc::scoped_refptr<VideoSourceInterface> source(
- factory->CreateVideoSource(capturer.release(), constraints.get()));
+ factory->CreateVideoSource(
+ reinterpret_cast<cricket::VideoCapturer*>(native_capturer),
+ constraints.get()));
return (jlong)source.release();
}