mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-25 03:01:03 +00:00
glbufferpool: fix allocator leak in some cases
Spotted by Sebastian Rasmussen. https://bugzilla.gnome.org/show_bug.cgi?id=734523
This commit is contained in:
parent
06961ea200
commit
15cd3d3d5c
1 changed files with 17 additions and 6 deletions
|
@ -83,8 +83,8 @@ gst_gl_buffer_pool_set_config (GstBufferPool * pool, GstStructure * config)
|
||||||
GstGLBufferPool *glpool = GST_GL_BUFFER_POOL_CAST (pool);
|
GstGLBufferPool *glpool = GST_GL_BUFFER_POOL_CAST (pool);
|
||||||
GstGLBufferPoolPrivate *priv = glpool->priv;
|
GstGLBufferPoolPrivate *priv = glpool->priv;
|
||||||
GstVideoInfo info;
|
GstVideoInfo info;
|
||||||
GstCaps *caps;
|
GstCaps *caps = NULL;
|
||||||
GstAllocator *allocator;
|
GstAllocator *allocator = NULL;
|
||||||
GstAllocationParams alloc_params;
|
GstAllocationParams alloc_params;
|
||||||
gboolean reset = TRUE;
|
gboolean reset = TRUE;
|
||||||
|
|
||||||
|
@ -104,11 +104,16 @@ gst_gl_buffer_pool_set_config (GstBufferPool * pool, GstStructure * config)
|
||||||
if (!gst_buffer_pool_config_get_allocator (config, &allocator, &alloc_params))
|
if (!gst_buffer_pool_config_get_allocator (config, &allocator, &alloc_params))
|
||||||
goto wrong_config;
|
goto wrong_config;
|
||||||
|
|
||||||
|
if (priv->allocator)
|
||||||
|
gst_object_unref (priv->allocator);
|
||||||
|
|
||||||
if (!allocator) {
|
if (!allocator) {
|
||||||
gst_gl_memory_init ();
|
gst_gl_memory_init ();
|
||||||
allocator = gst_allocator_find (GST_GL_MEMORY_ALLOCATOR);
|
priv->allocator = gst_allocator_find (GST_GL_MEMORY_ALLOCATOR);
|
||||||
|
} else {
|
||||||
|
priv->allocator = gst_object_ref (allocator);
|
||||||
}
|
}
|
||||||
priv->allocator = allocator;
|
|
||||||
priv->params = alloc_params;
|
priv->params = alloc_params;
|
||||||
|
|
||||||
priv->im_format = GST_VIDEO_INFO_FORMAT (&info);
|
priv->im_format = GST_VIDEO_INFO_FORMAT (&info);
|
||||||
|
@ -125,8 +130,9 @@ gst_gl_buffer_pool_set_config (GstBufferPool * pool, GstStructure * config)
|
||||||
GST_BUFFER_POOL_OPTION_VIDEO_META);
|
GST_BUFFER_POOL_OPTION_VIDEO_META);
|
||||||
|
|
||||||
#if GST_GL_HAVE_PLATFORM_EGL
|
#if GST_GL_HAVE_PLATFORM_EGL
|
||||||
priv->want_eglimage = (priv->allocator
|
g_assert (priv->allocator != NULL);
|
||||||
&& g_strcmp0 (priv->allocator->mem_type, GST_EGL_IMAGE_MEMORY_TYPE) == 0);
|
priv->want_eglimage =
|
||||||
|
(g_strcmp0 (priv->allocator->mem_type, GST_EGL_IMAGE_MEMORY_TYPE) == 0);
|
||||||
#else
|
#else
|
||||||
priv->want_eglimage = FALSE;
|
priv->want_eglimage = FALSE;
|
||||||
#endif
|
#endif
|
||||||
|
@ -368,4 +374,9 @@ gst_gl_buffer_pool_finalize (GObject * object)
|
||||||
gst_object_unref (pool->context);
|
gst_object_unref (pool->context);
|
||||||
pool->context = NULL;
|
pool->context = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (priv->allocator) {
|
||||||
|
gst_object_unref (priv->allocator);
|
||||||
|
priv->allocator = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue