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

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

Issue 1840193007: Android: Handle SurfaceTextureHelper ctor failure for decoder and capturer (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Addressing perkj@s comments Created 4 years, 7 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 | « webrtc/api/java/jni/androidmediadecoder_jni.cc ('k') | webrtc/api/java/jni/surfacetexturehelper_jni.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/api/java/jni/androidvideocapturer_jni.cc
diff --git a/webrtc/api/java/jni/androidvideocapturer_jni.cc b/webrtc/api/java/jni/androidvideocapturer_jni.cc
index 7165350e7deedc4a9180bafdb8eebec8d93022be..615fcb32d80c30895e4958215e96be5ef5ed9dda 100644
--- a/webrtc/api/java/jni/androidvideocapturer_jni.cc
+++ b/webrtc/api/java/jni/androidvideocapturer_jni.cc
@@ -30,18 +30,16 @@ int AndroidVideoCapturerJni::SetAndroidObjects(JNIEnv* jni,
return 0;
}
-AndroidVideoCapturerJni::AndroidVideoCapturerJni(
- JNIEnv* jni,
- jobject j_video_capturer,
- jobject j_egl_context)
+AndroidVideoCapturerJni::AndroidVideoCapturerJni(JNIEnv* jni,
+ jobject j_video_capturer,
+ jobject j_egl_context)
: j_video_capturer_(jni, j_video_capturer),
- j_video_capturer_class_(
- jni, FindClass(jni, "org/webrtc/VideoCapturer")),
+ j_video_capturer_class_(jni, FindClass(jni, "org/webrtc/VideoCapturer")),
j_observer_class_(
jni,
FindClass(jni,
"org/webrtc/VideoCapturer$NativeObserver")),
- surface_texture_helper_(new rtc::RefCountedObject<SurfaceTextureHelper>(
+ surface_texture_helper_(SurfaceTextureHelper::create(
jni, "Camera SurfaceTextureHelper", j_egl_context)),
capturer_(nullptr) {
LOG(LS_INFO) << "AndroidVideoCapturerJni ctor";
@@ -54,10 +52,12 @@ AndroidVideoCapturerJni::~AndroidVideoCapturerJni() {
*j_video_capturer_,
GetMethodID(jni(), *j_video_capturer_class_, "dispose", "()V"));
CHECK_EXCEPTION(jni()) << "error during VideoCapturer.dispose()";
- jni()->CallVoidMethod(
- surface_texture_helper_->GetJavaSurfaceTextureHelper(),
- GetMethodID(jni(), FindClass(jni(), "org/webrtc/SurfaceTextureHelper"),
- "dispose", "()V"));
+ if (surface_texture_helper_) {
+ jni()->CallVoidMethod(
+ surface_texture_helper_->GetJavaSurfaceTextureHelper(),
+ GetMethodID(jni(), FindClass(jni(), "org/webrtc/SurfaceTextureHelper"),
+ "dispose", "()V"));
+ }
CHECK_EXCEPTION(jni()) << "error during SurfaceTextureHelper.dispose()";
}
@@ -82,12 +82,12 @@ void AndroidVideoCapturerJni::Start(int width, int height, int framerate,
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_->GetJavaSurfaceTextureHelper(),
- application_context_,
- j_frame_observer);
+ jni()->CallVoidMethod(
+ *j_video_capturer_, m, width, height, framerate,
+ surface_texture_helper_
+ ? surface_texture_helper_->GetJavaSurfaceTextureHelper()
+ : nullptr,
+ application_context_, j_frame_observer);
CHECK_EXCEPTION(jni()) << "error during VideoCapturer.startCapture";
}
« no previous file with comments | « webrtc/api/java/jni/androidmediadecoder_jni.cc ('k') | webrtc/api/java/jni/surfacetexturehelper_jni.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698