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

Unified Diff: talk/app/webrtc/java/jni/peerconnection_jni.cc

Issue 1360173002: VideoCapturerAndroid: Add custom nativeCreateVideoCapturer() (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 5 years, 2 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
« no previous file with comments | « talk/app/webrtc/java/jni/androidvideocapturer_jni.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: talk/app/webrtc/java/jni/peerconnection_jni.cc
diff --git a/talk/app/webrtc/java/jni/peerconnection_jni.cc b/talk/app/webrtc/java/jni/peerconnection_jni.cc
index 67d51bd9cb4ef848838647cb6208cbdc3a5330e0..5fa1617644d048e0933c947a5e8002fa63b6c970 100644
--- a/talk/app/webrtc/java/jni/peerconnection_jni.cc
+++ b/talk/app/webrtc/java/jni/peerconnection_jni.cc
@@ -1672,17 +1672,21 @@ JOW(jobject, VideoCapturer_nativeCreateVideoCapturer)(
#if defined(ANDROID)
jclass j_video_capturer_class(
FindClass(jni, "org/webrtc/VideoCapturerAndroid"));
- const jmethodID j_videocapturer_ctor(GetMethodID(
- jni, j_video_capturer_class, "<init>", "()V"));
- jobject j_video_capturer = jni->NewObject(j_video_capturer_class,
- j_videocapturer_ctor);
- CHECK_EXCEPTION(jni) << "error during NewObject";
-
- rtc::scoped_refptr<AndroidVideoCapturerJni> delegate =
- AndroidVideoCapturerJni::Create(jni, j_video_capturer, j_device_name);
- if (!delegate.get())
+ const int camera_id = jni->CallStaticIntMethod(
+ j_video_capturer_class,
+ GetStaticMethodID(jni, j_video_capturer_class, "lookupDeviceName",
+ "(Ljava/lang/String;)I"),
+ j_device_name);
+ CHECK_EXCEPTION(jni) << "error during VideoCapturerAndroid.lookupDeviceName";
+ if (camera_id == -1)
return nullptr;
- rtc::scoped_ptr<webrtc::AndroidVideoCapturer> capturer(
+ jobject j_video_capturer = jni->NewObject(
+ j_video_capturer_class,
+ GetMethodID(jni, j_video_capturer_class, "<init>", "(I)V"), camera_id);
+ CHECK_EXCEPTION(jni) << "error during creation of VideoCapturerAndroid";
+ rtc::scoped_refptr<webrtc::AndroidVideoCapturerDelegate> delegate =
+ new rtc::RefCountedObject<AndroidVideoCapturerJni>(jni, j_video_capturer);
+ rtc::scoped_ptr<cricket::VideoCapturer> capturer(
new webrtc::AndroidVideoCapturer(delegate));
#else
@@ -1712,7 +1716,7 @@ JOW(jobject, VideoCapturer_nativeCreateVideoCapturer)(
jni, j_video_capturer_class, "setNativeCapturer", "(J)V"));
jni->CallVoidMethod(j_video_capturer,
j_videocapturer_set_native_capturer,
- (jlong)capturer.release());
+ jlongFromPointer(capturer.release()));
CHECK_EXCEPTION(jni) << "error during setNativeCapturer";
return j_video_capturer;
}
« no previous file with comments | « talk/app/webrtc/java/jni/androidvideocapturer_jni.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698