[vlc-devel] [PATCH] android: utils: avoid non-android windows
Steve Lhomme
robux4 at ycbcr.xyz
Fri Jan 22 06:59:54 UTC 2021
On 2021-01-21 10:33, Alexandre Janniaux wrote:
> When using opengl callbacks on Android, a dummy window is passed instead
> of NULL or an Android window. As long as JVM has been given, we can
> still create the AWindowHandler for the decoder device though.
Is this fixing anything ? Because I only see 2 calls.
In android/window OpenDecDevice:
if (window && window->type == VOUT_WINDOW_TYPE_ANDROID_NATIVE)
awh = window->handle.anativewindow;
else
awh = AWindowHandler_new(VLC_OBJECT(device), NULL, NULL);
In this case the value is NULL and the code may explode during calls to
to internal functions that use it to log things or even other code.
AWindowHandler_new itself properly checks for NULL (but your patch
doesn't and will crash with a NULL dereference).
In android/window Open:
AWindowHandler *p_awh = AWindowHandler_new(VLC_OBJECT(wnd), wnd,
&(awh_events_t) { OnNewWindowSize, OnNewMouseCoords });
if (p_awh == NULL)
return VLC_EGENERIC;
wnd->type = VOUT_WINDOW_TYPE_ANDROID_NATIVE;
Here the window type is not even set during the call.
> ---
> modules/video_output/android/utils.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/modules/video_output/android/utils.c b/modules/video_output/android/utils.c
> index e46b8e004d..c4c549e476 100644
> --- a/modules/video_output/android/utils.c
> +++ b/modules/video_output/android/utils.c
> @@ -818,6 +818,9 @@ AWindowHandler_new(vlc_object_t *obj, vout_window_t *wnd, awh_events_t *p_events
> #define AWINDOW_REGISTER_FLAGS_SUCCESS 0x1
> #define AWINDOW_REGISTER_FLAGS_HAS_VIDEO_LAYOUT_LISTENER 0x2
>
> + if (wnd->type != VOUT_WINDOW_TYPE_ANDROID_NATIVE)
> + wnd = NULL;
> +
> AWindowHandler *p_awh;
> JNIEnv *p_env;
> JavaVM *p_jvm = var_InheritAddress(obj, "android-jvm");
> --
> 2.30.0
>
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel
>
More information about the vlc-devel
mailing list