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

Unified Diff: webrtc/api/java/jni/peerconnection_jni.cc

Issue 1684403002: Android: Remove VideoCapturer (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Nuke VideoCapturer 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/jni/peerconnection_jni.cc
diff --git a/webrtc/api/java/jni/peerconnection_jni.cc b/webrtc/api/java/jni/peerconnection_jni.cc
index a19e79a624593238176b7ba9e603c8e78958cb4f..236ac713087f20fb9b5acc8c4e96487ac9c8698e 100644
--- a/webrtc/api/java/jni/peerconnection_jni.cc
+++ b/webrtc/api/java/jni/peerconnection_jni.cc
@@ -910,10 +910,6 @@ JOW(void, MediaSource_free)(JNIEnv*, jclass, jlong j_p) {
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);
}
@@ -1216,16 +1212,26 @@ JOW(jlong, PeerConnectionFactory_nativeCreateLocalMediaStream)(
}
JOW(jlong, PeerConnectionFactory_nativeCreateVideoSource)(
- JNIEnv* jni, jclass, jlong native_factory, jlong native_capturer,
+ JNIEnv* jni, jclass, jlong native_factory, jobject j_video_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(
- reinterpret_cast<cricket::VideoCapturer*>(native_capturer),
- constraints.get()));
+ factory->CreateVideoSource(capturer.release(), constraints.get()));
return (jlong)source.release();
}
« no previous file with comments | « webrtc/api/java/jni/androidvideocapturer_jni.cc ('k') | webrtc/api/java/src/org/webrtc/PeerConnectionFactory.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698