mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-18 22:36:33 +00:00
cudamemorycopy: Fix GL resource leak
Clear GL resources on stop() Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1896>
This commit is contained in:
parent
17f11c2cda
commit
496b77e6aa
1 changed files with 16 additions and 3 deletions
|
@ -100,6 +100,7 @@ G_DEFINE_ABSTRACT_TYPE (GstCudaMemoryCopy, gst_cuda_memory_copy,
|
|||
|
||||
static void gst_cuda_memory_copy_set_context (GstElement * element,
|
||||
GstContext * context);
|
||||
static gboolean gst_cuda_memory_copy_transform_stop (GstBaseTransform * trans);
|
||||
static GstCaps *gst_cuda_memory_copy_transform_caps (GstBaseTransform * trans,
|
||||
GstPadDirection direction, GstCaps * caps, GstCaps * filter);
|
||||
static gboolean gst_cuda_memory_copy_query (GstBaseTransform * trans,
|
||||
|
@ -125,6 +126,7 @@ gst_cuda_memory_copy_class_init (GstCudaMemoryCopyClass * klass)
|
|||
element_class->set_context =
|
||||
GST_DEBUG_FUNCPTR (gst_cuda_memory_copy_set_context);
|
||||
|
||||
trans_class->stop = GST_DEBUG_FUNCPTR (gst_cuda_memory_copy_transform_stop);
|
||||
trans_class->transform_caps =
|
||||
GST_DEBUG_FUNCPTR (gst_cuda_memory_copy_transform_caps);
|
||||
trans_class->propose_allocation =
|
||||
|
@ -155,6 +157,20 @@ gst_cuda_memory_copy_set_context (GstElement * element, GstContext * context)
|
|||
GST_ELEMENT_CLASS (parent_class)->set_context (element, context);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_cuda_memory_copy_transform_stop (GstBaseTransform * trans)
|
||||
{
|
||||
#ifdef HAVE_NVCODEC_GST_GL
|
||||
GstCudaMemoryCopy *self = GST_CUDA_MEMORY_COPY (trans);
|
||||
|
||||
gst_clear_object (&self->gl_display);
|
||||
gst_clear_object (&self->gl_context);
|
||||
gst_clear_object (&self->other_gl_context);
|
||||
#endif
|
||||
|
||||
return GST_BASE_TRANSFORM_CLASS (parent_class)->stop (trans);
|
||||
}
|
||||
|
||||
static GstCaps *
|
||||
_set_caps_features (const GstCaps * caps, const gchar * feature_name)
|
||||
{
|
||||
|
@ -1329,9 +1345,6 @@ gst_cuda_upload_class_init (GstCudaUploadClass * klass, gpointer data)
|
|||
GstCudaMemoryCopyClass *copy_class = GST_CUDA_MEMORY_COPY_CLASS (klass);
|
||||
GstCudaMemoryCopyClassData *cdata = (GstCudaMemoryCopyClassData *) data;
|
||||
|
||||
element_class->set_context =
|
||||
GST_DEBUG_FUNCPTR (gst_cuda_memory_copy_set_context);
|
||||
|
||||
gst_element_class_add_pad_template (element_class,
|
||||
gst_pad_template_new ("sink", GST_PAD_SINK, GST_PAD_ALWAYS,
|
||||
cdata->sink_caps));
|
||||
|
|
Loading…
Reference in a new issue