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

Unified Diff: webrtc/api/android/jni/androidvideocapturer_jni.cc

Issue 2122693002: Android: Add initialize() function to VideoCapturer interface (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Move init member variables to separate section Created 4 years, 5 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/android/jni/androidvideocapturer_jni.cc
diff --git a/webrtc/api/android/jni/androidvideocapturer_jni.cc b/webrtc/api/android/jni/androidvideocapturer_jni.cc
index 150f1c4c93462cc5e29d98764898135e0236cacd..f9c334b39455100f0690d95e53d907df9c9cc476 100644
--- a/webrtc/api/android/jni/androidvideocapturer_jni.cc
+++ b/webrtc/api/android/jni/androidvideocapturer_jni.cc
@@ -43,6 +43,21 @@ AndroidVideoCapturerJni::AndroidVideoCapturerJni(JNIEnv* jni,
jni, "Camera SurfaceTextureHelper", j_egl_context)),
capturer_(nullptr) {
LOG(LS_INFO) << "AndroidVideoCapturerJni ctor";
+ jobject j_frame_observer =
+ jni->NewObject(*j_observer_class_,
+ GetMethodID(jni, *j_observer_class_, "<init>", "(J)V"),
+ jlongFromPointer(this));
+ CHECK_EXCEPTION(jni) << "error during NewObject";
+ jni->CallVoidMethod(
+ *j_video_capturer_,
+ GetMethodID(jni, *j_video_capturer_class_, "initialize",
+ "(Lorg/webrtc/SurfaceTextureHelper;Landroid/content/"
+ "Context;Lorg/webrtc/VideoCapturer$CapturerObserver;)V"),
+ surface_texture_helper_
+ ? surface_texture_helper_->GetJavaSurfaceTextureHelper()
+ : nullptr,
+ application_context_, j_frame_observer);
+ CHECK_EXCEPTION(jni) << "error during VideoCapturer.initialize()";
thread_checker_.DetachFromThread();
}
@@ -65,22 +80,9 @@ void AndroidVideoCapturerJni::Start(int width, int height, int framerate,
capturer_ = capturer;
invoker_.reset(new rtc::GuardedAsyncInvoker());
}
- jobject j_frame_observer =
- jni()->NewObject(*j_observer_class_,
- GetMethodID(jni(), *j_observer_class_, "<init>", "(J)V"),
- jlongFromPointer(this));
- CHECK_EXCEPTION(jni()) << "error during NewObject";
-
- jmethodID m = GetMethodID(
- jni(), *j_video_capturer_class_, "startCapture",
- "(IIILorg/webrtc/SurfaceTextureHelper;Landroid/content/Context;"
- "Lorg/webrtc/VideoCapturer$CapturerObserver;)V");
- jni()->CallVoidMethod(
- *j_video_capturer_, m, width, height, framerate,
- surface_texture_helper_
- ? surface_texture_helper_->GetJavaSurfaceTextureHelper()
- : nullptr,
- application_context_, j_frame_observer);
+ jmethodID m =
+ GetMethodID(jni(), *j_video_capturer_class_, "startCapture", "(III)V");
+ jni()->CallVoidMethod(*j_video_capturer_, m, width, height, framerate);
CHECK_EXCEPTION(jni()) << "error during VideoCapturer.startCapture";
}

Powered by Google App Engine
This is Rietveld 408576698