[vlc-commits] [Git][videolan/vlc][master] 2 commits: opengl: android: release TexImage after detaching it

Felix Paul Kühne (@fkuehne) gitlab at videolan.org
Sun Feb 16 14:22:26 UTC 2025



Felix Paul Kühne pushed to branch master at VideoLAN / VLC


Commits:
84813e65 by Thomas Guillem at 2025-02-16T14:00:49+00:00
opengl: android: release TexImage after detaching it

- - - - -
c692e903 by Thomas Guillem at 2025-02-16T14:00:49+00:00
vout: android: call SurfaceTexture.release() explicitly

The gc might not release the SurfaceTexture from its destructor.

- - - - -


2 changed files:

- modules/video_output/android/utils.c
- modules/video_output/opengl/interop_android.c


Changes:

=====================================
modules/video_output/android/utils.c
=====================================
@@ -103,6 +103,7 @@ struct vlc_android_jfields
           jmethodID init_iz;
           jmethodID init_z;
           jmethodID updateTexImage;
+          jmethodID release;
           jmethodID releaseTexImage;
           jmethodID getTransformMatrix;
           jmethodID detachFromGLContext;
@@ -374,6 +375,9 @@ static void NDKSurfaceTexture_destroy(
     if (!p_env)
         return;
 
+    (*p_env)->CallVoidMethod(p_env, handle->jtexture,
+                             handle->awh->jfields.SurfaceTexture.release);
+
     if (handle->surface.window)
         handle->awh->pf_winRelease(handle->surface.window);
 
@@ -497,6 +501,9 @@ static void JNISurfaceTexture_destroy(
     if (!p_env)
         return;
 
+    (*p_env)->CallVoidMethod(p_env, handle->jtexture,
+                             handle->awh->jfields.SurfaceTexture.release);
+
     if (handle->surface.window)
         handle->awh->pf_winRelease(handle->surface.window);
     if (handle->surface.jsurface)
@@ -677,6 +684,9 @@ InitJNIFields(JNIEnv *env, vlc_object_t *p_obj, jobject *jobj, AWindowHandler *a
     GET_METHOD(SurfaceTexture, getTransformMatrix,
                "getTransformMatrix", "([F)V", true);
 
+    GET_METHOD(SurfaceTexture, release,
+               "release", "()V", true);
+
     GET_METHOD(SurfaceTexture, releaseTexImage,
                "releaseTexImage", "()V", false);
 


=====================================
modules/video_output/opengl/interop_android.c
=====================================
@@ -180,7 +180,10 @@ Close(struct vlc_gl_interop *interop)
     struct priv *priv = interop->priv;
 
     if (priv->previous_texture)
+    {
         SurfaceTexture_detachFromGLContext(priv->previous_texture);
+        SurfaceTexture_releaseTexImage(priv->previous_texture);
+    }
 
     if (priv->current_picture)
         picture_Release(priv->current_picture);



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/4eb6a6475ace363a17d2b661e77f5136b502995c...c692e9030606a7e065cd7c80e801617b66410b7d

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/4eb6a6475ace363a17d2b661e77f5136b502995c...c692e9030606a7e065cd7c80e801617b66410b7d
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