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

Unified Diff: talk/app/webrtc/java/jni/androidvideocapturer_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.h ('k') | talk/app/webrtc/java/jni/peerconnection_jni.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: talk/app/webrtc/java/jni/androidvideocapturer_jni.cc
diff --git a/talk/app/webrtc/java/jni/androidvideocapturer_jni.cc b/talk/app/webrtc/java/jni/androidvideocapturer_jni.cc
index 74a9372d866e1d8042f478bedc46aeacf4f50814..93b169526cf2c9f8838827288219cacc95420915 100644
--- a/talk/app/webrtc/java/jni/androidvideocapturer_jni.cc
+++ b/talk/app/webrtc/java/jni/androidvideocapturer_jni.cc
@@ -46,22 +46,6 @@ int AndroidVideoCapturerJni::SetAndroidObjects(JNIEnv* jni,
return 0;
}
-// static
-rtc::scoped_refptr<AndroidVideoCapturerJni>
-AndroidVideoCapturerJni::Create(JNIEnv* jni,
- jobject j_video_capture,
- jstring device_name) {
- LOG(LS_INFO) << "AndroidVideoCapturerJni::Create";
- rtc::scoped_refptr<AndroidVideoCapturerJni> capturer(
- new rtc::RefCountedObject<AndroidVideoCapturerJni>(jni, j_video_capture));
-
- if (capturer->Init(device_name)) {
- return capturer;
- }
- LOG(LS_ERROR) << "AndroidVideoCapturerJni init fails";
- return nullptr;
-}
-
AndroidVideoCapturerJni::AndroidVideoCapturerJni(JNIEnv* jni,
jobject j_video_capturer)
: j_capturer_global_(jni, j_video_capturer),
@@ -76,16 +60,6 @@ AndroidVideoCapturerJni::AndroidVideoCapturerJni(JNIEnv* jni,
thread_checker_.DetachFromThread();
}
-bool AndroidVideoCapturerJni::Init(jstring device_name) {
- const jmethodID m(GetMethodID(
- jni(), *j_video_capturer_class_, "init", "(Ljava/lang/String;)Z"));
- if (!jni()->CallBooleanMethod(*j_capturer_global_, m, device_name)) {
- return false;
- }
- CHECK_EXCEPTION(jni()) << "error during CallVoidMethod";
- return true;
-}
-
AndroidVideoCapturerJni::~AndroidVideoCapturerJni() {
LOG(LS_INFO) << "AndroidVideoCapturerJni dtor";
jni()->CallVoidMethod(
@@ -246,4 +220,14 @@ JOW(void, VideoCapturerAndroid_00024NativeObserver_nativeOnOutputFormatRequest)
j_width, j_height, j_fps);
}
+JOW(jlong, VideoCapturerAndroid_nativeCreateVideoCapturer)
+ (JNIEnv* jni, jclass, jobject j_video_capturer) {
+ rtc::scoped_refptr<webrtc::AndroidVideoCapturerDelegate> delegate =
+ new rtc::RefCountedObject<AndroidVideoCapturerJni>(jni, j_video_capturer);
+ rtc::scoped_ptr<cricket::VideoCapturer> capturer(
+ new webrtc::AndroidVideoCapturer(delegate));
+ // Caller takes ownership of the cricket::VideoCapturer* pointer.
+ return jlongFromPointer(capturer.release());
+}
+
} // namespace webrtc_jni
« no previous file with comments | « talk/app/webrtc/java/jni/androidvideocapturer_jni.h ('k') | talk/app/webrtc/java/jni/peerconnection_jni.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698