Commit e20d7eaa authored by Sylvain Berfini's avatar Sylvain Berfini 🐮
Browse files

Check that SurfaceTexture isn't null before trying to create a Surface from it

parent 22f5204c
......@@ -792,12 +792,19 @@ static void android_camera2_capture_create_surface_from_surface_texture(AndroidC
if (surfaceTexture == nullptr) {
ms_error("[Camera2 Capture] SurfaceTexture is null, can't create a Surface!");
ms_message("[Camera2 Capture] Creating Surface from SurfaceTexture %p", surfaceTexture);
jmethodID ctor = env->GetMethodID(surfaceClass, "<init>", "(Landroid/graphics/SurfaceTexture;)V");
surface = env->NewObject(surfaceClass, ctor, surfaceTexture);
if (!surface) {
ms_error("[Camera2 Capture] Could not instanciate android.view.Surface object");
d->surface = (jobject)env->NewGlobalRef(surface);
ms_message("[Camera2 Capture] Got Surface %p from SurfaceTexture %p", d->surface, surfaceTexture);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment