[vlc-commits] opengl: cvpx: change CVOpenGLESTextureRef release order
Thomas Guillem
git at videolan.org
Fri Nov 24 13:11:59 CET 2017
vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Fri Nov 24 09:05:00 2017 +0100| [23c823b896ac9f4a589d4aa8ad720a01f7c9bdf7] | committer: Thomas Guillem
opengl: cvpx: change CVOpenGLESTextureRef release order
Release textures earlier before the texture cache flush.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=23c823b896ac9f4a589d4aa8ad720a01f7c9bdf7
---
modules/video_output/opengl/converter_cvpx.c | 30 ++++++++++++++++++----------
1 file changed, 19 insertions(+), 11 deletions(-)
diff --git a/modules/video_output/opengl/converter_cvpx.c b/modules/video_output/opengl/converter_cvpx.c
index b39b081a09..0954f8a0f3 100644
--- a/modules/video_output/opengl/converter_cvpx.c
+++ b/modules/video_output/opengl/converter_cvpx.c
@@ -35,11 +35,11 @@
struct priv
{
- picture_t *last_pic;
#if TARGET_OS_IPHONE
CVOpenGLESTextureCacheRef cache;
CVOpenGLESTextureRef last_cvtexs[PICTURE_PLANE_MAX];
#else
+ picture_t *last_pic;
CGLContextObj gl_ctx;
#endif
};
@@ -56,6 +56,15 @@ tc_cvpx_update(const opengl_tex_converter_t *tc, GLuint *textures,
CVPixelBufferRef pixelBuffer = cvpxpic_get_ref(pic);
+ for (unsigned i = 0; i < tc->tex_count; ++i)
+ {
+ if (likely(priv->last_cvtexs[i]))
+ {
+ CFRelease(priv->last_cvtexs[i]);
+ priv->last_cvtexs[i] = NULL;
+ }
+ }
+
CVOpenGLESTextureCacheFlush(priv->cache, 0);
for (unsigned i = 0; i < tc->tex_count; ++i)
@@ -79,17 +88,10 @@ tc_cvpx_update(const opengl_tex_converter_t *tc, GLuint *textures,
tc->vt->TexParameteri(tc->tex_target, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
tc->vt->TexParameterf(tc->tex_target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
tc->vt->TexParameterf(tc->tex_target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
- if (likely(priv->last_cvtexs[i]))
- CFRelease(priv->last_cvtexs[i]);
+ tc->vt->BindTexture(tc->tex_target, 0);
priv->last_cvtexs[i] = cvtex;
}
- if (priv->last_pic != pic)
- {
- if (priv->last_pic != NULL)
- picture_Release(priv->last_pic);
- priv->last_pic = picture_Hold(pic);
- }
return VLC_SUCCESS;
}
@@ -144,10 +146,16 @@ Close(vlc_object_t *obj)
opengl_tex_converter_t *tc = (void *)obj;
struct priv *priv = tc->priv;
- if (priv->last_pic != NULL)
- picture_Release(priv->last_pic);
#if TARGET_OS_IPHONE
+ for (unsigned i = 0; i < tc->tex_count; ++i)
+ {
+ if (likely(priv->last_cvtexs[i]))
+ CFRelease(priv->last_cvtexs[i]);
+ }
CFRelease(priv->cache);
+#else
+ if (priv->last_pic != NULL)
+ picture_Release(priv->last_pic);
#endif
free(tc->priv);
}
More information about the vlc-commits
mailing list