From 282c7eca0652249d438ffa2758aba1b1a5ad038a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wang=20Xin-yu=20=28=E7=8E=8B=E6=98=95=E5=AE=87=29?= Date: Thu, 21 Jan 2016 10:40:36 +0800 Subject: [PATCH] glvideomixer: don't leak pad's vertex buffer on release_pad https://bugzilla.gnome.org/show_bug.cgi?id=760873 --- ext/gl/gstglvideomixer.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/ext/gl/gstglvideomixer.c b/ext/gl/gstglvideomixer.c index e0fd427756..e48151bd04 100644 --- a/ext/gl/gstglvideomixer.c +++ b/ext/gl/gstglvideomixer.c @@ -836,6 +836,26 @@ gst_gl_video_mixer_pad_set_property (GObject * object, guint prop_id, gst_object_unref (mix); } +static void +_del_buffer (GstGLContext * context, GLuint * pBuffer) +{ + context->gl_vtable->DeleteBuffers (1, pBuffer); +} + +static void +gst_gl_video_mixer_release_pad (GstElement * element, GstPad * p) +{ + GstGLVideoMixerPad *pad = GST_GL_VIDEO_MIXER_PAD (p); + if (pad->vertex_buffer) { + GstGLBaseMixer *mix = GST_GL_BASE_MIXER (element); + gst_gl_context_thread_add (mix->context, (GstGLContextThreadFunc) + _del_buffer, &pad->vertex_buffer); + pad->vertex_buffer = 0; + } + GST_ELEMENT_CLASS (g_type_class_peek_parent (G_OBJECT_GET_CLASS (element))) + ->release_pad (element, p); +} + static void gst_gl_video_mixer_class_init (GstGLVideoMixerClass * klass) { @@ -846,6 +866,7 @@ gst_gl_video_mixer_class_init (GstGLVideoMixerClass * klass) gobject_class = (GObjectClass *) klass; element_class = GST_ELEMENT_CLASS (klass); + element_class->release_pad = gst_gl_video_mixer_release_pad; gobject_class->set_property = gst_gl_video_mixer_set_property; gobject_class->get_property = gst_gl_video_mixer_get_property;