[vlc-commits] [Git][videolan/vlc][3.0.x] 3 commits: vout: android: remove AndroidWindow_ConfigureJavaSurface
Felix Paul Kühne (@fkuehne)
gitlab at videolan.org
Sat Apr 12 15:14:53 UTC 2025
Felix Paul Kühne pushed to branch 3.0.x at VideoLAN / VLC
Commits:
0df7b1be by Thomas Guillem at 2025-04-08T15:20:38+02:00
vout: android: remove AndroidWindow_ConfigureJavaSurface
It was a hack for Android 2 and 3, removed since in a long time in vlc-android.
- - - - -
8c339ae3 by Thomas Guillem at 2025-04-08T15:20:38+02:00
vout: android: revert window to base values
This fixes OpenGL vout layout when it is used just after with the same
Android Surface.
This android vout is normally only used with opaque chroma (mediacodec),
and the opengl one should be used for software rendering.
Nevertheless, this vout could be used for software rendering when the
OpenGL one failed. This was the case when the avcodec AV1-hw decoder
requested a VAAPI chroma (via a YUV chroma fallback).
Fixes #29120
- - - - -
74de0fda by Thomas Guillem at 2025-04-08T16:32:42+02:00
avcodec: enable AV1-hw only for Windows
To avoid crazy chroma chain configuration that will always fail in the end.
- - - - -
4 changed files:
- modules/codec/avcodec/video.c
- modules/video_output/android/display.c
- modules/video_output/android/utils.c
- modules/video_output/android/utils.h
Changes:
=====================================
modules/codec/avcodec/video.c
=====================================
@@ -758,6 +758,7 @@ static int ExtractAV1Profile(AVCodecContext *p_context, const es_format_t *fmt_i
int InitVideoHwDec( vlc_object_t *obj )
{
+#ifdef _WIN32
decoder_t *p_dec = container_of(obj, decoder_t, obj);
if (p_dec->fmt_in.i_codec != VLC_CODEC_AV1)
@@ -802,6 +803,7 @@ int InitVideoHwDec( vlc_object_t *obj )
failed:
avcodec_free_context( &p_context );
free(p_sys);
+#endif
return VLC_EGENERIC;
}
=====================================
modules/video_output/android/display.c
=====================================
@@ -430,8 +430,7 @@ static int AndroidWindow_UpdateCrop(vout_display_sys_t *sys,
}
static int AndroidWindow_SetupANWP(vout_display_sys_t *sys,
- android_window *p_window,
- bool b_java_configured)
+ android_window *p_window)
{
unsigned int i_max_buffer_count = 0;
@@ -444,8 +443,7 @@ static int AndroidWindow_SetupANWP(vout_display_sys_t *sys,
if (sys->anwp.setUsage(p_window->p_surface_priv, false, 0) != 0)
goto error;
- if (!b_java_configured
- && sys->anwp.setBuffersGeometry(p_window->p_surface_priv,
+ if (sys->anwp.setBuffersGeometry(p_window->p_surface_priv,
p_window->fmt.i_width,
p_window->fmt.i_height,
p_window->i_android_hal) != 0)
@@ -483,39 +481,13 @@ error:
return -1;
}
-static int AndroidWindow_ConfigureJavaSurface(vout_display_sys_t *sys,
- android_window *p_window,
- bool *p_java_configured)
-{
- /* setBuffersGeometry is broken before ics. Use
- * AJavaWindow_setBuffersGeometry to configure the surface on the java side
- * synchronously. AJavaWindow_setBuffersGeometry return en error when you
- * don't need to call it (ie, after ics). if this call succeed, you need to
- * get a new surface handle. That's why AndroidWindow_DisconnectSurface is
- * called here. */
- if (AWindowHandler_setBuffersGeometry(sys->p_awh, p_window->id,
- p_window->fmt.i_width,
- p_window->fmt.i_height,
- p_window->i_android_hal) == VLC_SUCCESS)
- {
- *p_java_configured = true;
- AndroidWindow_DisconnectSurface(sys, p_window);
- if (AndroidWindow_ConnectSurface(sys, p_window) != 0)
- return -1;
- } else
- *p_java_configured = false;
-
- return 0;
-}
-
static int AndroidWindow_SetupANW(vout_display_sys_t *sys,
- android_window *p_window,
- bool b_java_configured)
+ android_window *p_window)
{
p_window->i_pic_count = 1;
p_window->i_min_undequeued = 0;
- if (!b_java_configured && sys->anw->setBuffersGeometry)
+ if (sys->anw->setBuffersGeometry)
return sys->anw->setBuffersGeometry(p_window->p_surface,
p_window->fmt.i_width,
p_window->fmt.i_height,
@@ -528,8 +500,6 @@ static int AndroidWindow_Setup(vout_display_sys_t *sys,
android_window *p_window,
unsigned int i_pic_count)
{
- bool b_java_configured = false;
-
if (i_pic_count != 0)
p_window->i_pic_count = i_pic_count;
@@ -543,13 +513,9 @@ static int AndroidWindow_Setup(vout_display_sys_t *sys,
p_window->fmt.i_width = (p_pic->format.i_width + align_pixels) & ~align_pixels;
picture_Release(p_pic);
- if (AndroidWindow_ConfigureJavaSurface(sys, p_window,
- &b_java_configured) != 0)
- return -1;
-
if (!p_window->b_use_priv
- || AndroidWindow_SetupANWP(sys, p_window, b_java_configured) != 0) {
- if (AndroidWindow_SetupANW(sys, p_window, b_java_configured) != 0)
+ || AndroidWindow_SetupANWP(sys, p_window) != 0) {
+ if (AndroidWindow_SetupANW(sys, p_window) != 0)
return -1;
}
} else {
@@ -860,6 +826,8 @@ static void Close(vlc_object_t *p_this)
{
if (sys->b_displayed)
ClearSurface(vd);
+ if (!sys->p_window->b_opaque && !sys->p_window->b_use_priv)
+ sys->anw->setBuffersGeometry(sys->p_window->p_surface, 0, 0, 0);
AndroidWindow_Destroy(vd, sys->p_window);
}
=====================================
modules/video_output/android/utils.c
=====================================
@@ -80,7 +80,6 @@ static struct
jmethodID getSubtitlesSurface;
jmethodID registerNative;
jmethodID unregisterNative;
- jmethodID setBuffersGeometry;
jmethodID setVideoLayout;
} AndroidNativeWindow;
struct {
@@ -455,8 +454,6 @@ InitJNIFields(JNIEnv *env, vlc_object_t *p_obj, jobject *jobj)
"registerNative", "(J)I", true);
GET_METHOD(AndroidNativeWindow.unregisterNative,
"unregisterNative", "()V", true);
- GET_METHOD(AndroidNativeWindow.setBuffersGeometry,
- "setBuffersGeometry", "(Landroid/view/Surface;III)Z", true);
GET_METHOD(AndroidNativeWindow.setVideoLayout,
"setVideoLayout", "(IIIIII)V", true);
@@ -716,24 +713,6 @@ AndroidNativeWindow_onWindowSize(JNIEnv* env, jobject clazz, jlong handle,
p_awh->event.cb.on_new_window_size(p_awh->wnd, width, height);
}
-int
-AWindowHandler_setBuffersGeometry(AWindowHandler *p_awh, enum AWindow_ID id,
- int i_width, int i_height, int i_format)
-{
- jobject jsurf;
- JNIEnv *p_env = AWindowHandler_getEnv(p_awh);
- if (!p_env)
- return VLC_EGENERIC;
-
- jsurf = AWindowHandler_getSurface(p_awh, id);
- if (!jsurf)
- return VLC_EGENERIC;
-
- return JNI_ANWCALL(CallBooleanMethod, setBuffersGeometry,
- jsurf, i_width, i_height, i_format) ? VLC_SUCCESS
- : VLC_EGENERIC;
-}
-
bool
AWindowHandler_canSetVideoLayout(AWindowHandler *p_awh)
{
=====================================
modules/video_output/android/utils.h
=====================================
@@ -150,16 +150,6 @@ ANativeWindow *AWindowHandler_getANativeWindow(AWindowHandler *p_awh,
*/
void AWindowHandler_releaseANativeWindow(AWindowHandler *p_awh,
enum AWindow_ID id);
-/**
- * Pre-ICS hack of ANativeWindow_setBuffersGeometry
- *
- * This function is a fix up of ANativeWindow_setBuffersGeometry that doesn't
- * work before Android ICS. It configures the Surface from the Android
- * MainThread via a SurfaceHolder. It returns VLC_SUCCESS if the Surface was
- * configured (it returns VLC_EGENERIC after Android ICS).
- */
-int AWindowHandler_setBuffersGeometry(AWindowHandler *p_awh, enum AWindow_ID id,
- int i_width, int i_height, int i_format);
/**
* Returns true if the video layout can be changed
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/281cbc8548732ed2d4ab20330823d93a8bbf46dc...74de0fda0bec6507ba1e305f7943150140f9dc44
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/281cbc8548732ed2d4ab20330823d93a8bbf46dc...74de0fda0bec6507ba1e305f7943150140f9dc44
You're receiving this email because of your account on code.videolan.org.
VideoLAN code repository instance
More information about the vlc-commits
mailing list