Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
BC
public
msandroidcamera2
Commits
e20d7eaa
Commit
e20d7eaa
authored
Aug 28, 2020
by
Sylvain Berfini
🐮
Browse files
Check that SurfaceTexture isn't null before trying to create a Surface from it
parent
22f5204c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
0 deletions
+7
-0
android-camera2-capture.cpp
android-camera2-capture.cpp
+7
-0
No files found.
android-camera2-capture.cpp
View file @
e20d7eaa
...
...
@@ -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!"
);
return
;
}
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"
);
return
;
}
d
->
surface
=
(
jobject
)
env
->
NewGlobalRef
(
surface
);
ms_message
(
"[Camera2 Capture] Got Surface %p from SurfaceTexture %p"
,
d
->
surface
,
surfaceTexture
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment