From 59088f5a90960cde183a72bde2754be749750aa6 Mon Sep 17 00:00:00 2001 From: Matthew Waters Date: Tue, 3 Jun 2014 13:59:51 +1000 Subject: [PATCH] glupload: always release the previous buffer Fixes the case where _perform_with_buffer() is called without intervening calls to _release_buffer() as is the case on start up with glimagesink. Also release the buffer when reseting the upload. https://bugzilla.gnome.org/show_bug.cgi?id=731107 --- gst-libs/gst/gl/gstglupload.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/gst-libs/gst/gl/gstglupload.c b/gst-libs/gst/gl/gstglupload.c index 7127b3a18f..ed54dfe575 100644 --- a/gst-libs/gst/gl/gstglupload.c +++ b/gst-libs/gst/gl/gstglupload.c @@ -65,6 +65,7 @@ struct _GstGLUploadPrivate GstVideoGLTextureUploadMeta *meta; GstBuffer *outbuf; + gboolean released; }; GST_DEBUG_CATEGORY_STATIC (gst_gl_upload_debug); @@ -161,6 +162,8 @@ gst_gl_upload_reset (GstGLUpload * upload) upload->in_tex[i] = NULL; } } + + gst_gl_upload_release_buffer (upload); } static void @@ -241,6 +244,8 @@ gst_gl_upload_perform_with_buffer (GstGLUpload * upload, GstBuffer * buffer, g_return_val_if_fail (tex_id != NULL, FALSE); g_return_val_if_fail (gst_buffer_n_memory (buffer) > 0, FALSE); + gst_gl_upload_release_buffer (upload); + /* GstGLMemory */ mem = gst_buffer_peek_memory (buffer, 0); @@ -330,6 +335,8 @@ gst_gl_upload_release_buffer (GstGLUpload * upload) gst_buffer_unref (upload->priv->outbuf); upload->priv->outbuf = NULL; } + + upload->priv->released = TRUE; } /* @@ -539,6 +546,7 @@ _upload_memory (GstGLUpload * upload) upload->out_tex->tex_id = *(guint *) out_frame.data[0]; gst_video_frame_unmap (&out_frame); + upload->priv->released = FALSE; return TRUE; }