From acd33a240f3283dc0ed41b361ecf2ebc501978ae Mon Sep 17 00:00:00 2001 From: Alessandro Decina Date: Mon, 5 Sep 2016 14:44:24 +1000 Subject: [PATCH] glupload: create the GstGLUpload object in ::transform_caps Previously it was created in the init function and destroyed in ::stop, which lead to segfaults when reusing the element. Now the upload object is created in ::transform_caps if it is NULL, which is the earliest we need it. The other vfuncs already bail out if the upload object is NULL, which means that negotiation wasn't done. --- ext/gl/gstgluploadelement.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ext/gl/gstgluploadelement.c b/ext/gl/gstgluploadelement.c index f458a4323d..d3ed276dde 100644 --- a/ext/gl/gstgluploadelement.c +++ b/ext/gl/gstgluploadelement.c @@ -97,8 +97,6 @@ static void gst_gl_upload_element_init (GstGLUploadElement * upload) { gst_base_transform_set_prefer_passthrough (GST_BASE_TRANSFORM (upload), TRUE); - - upload->upload = gst_gl_upload_new (NULL); } static gboolean @@ -138,6 +136,9 @@ _gst_gl_upload_element_transform_caps (GstBaseTransform * bt, GstGLUploadElement *upload = GST_GL_UPLOAD_ELEMENT (bt); GstGLContext *context = GST_GL_BASE_FILTER (bt)->context; + if (upload->upload == NULL) + upload->upload = gst_gl_upload_new (NULL); + return gst_gl_upload_transform_caps (upload->upload, context, direction, caps, filter); }