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.
This commit is contained in:
Alessandro Decina 2016-09-05 14:44:24 +10:00
parent 35d147930d
commit c16d57cc9a

View file

@ -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);
}