vaapivideobufferpool: Reuse internal allocator is possible.

Instead of creating a new allocator when upstream requests a different
allocator, this patch tries to reuse the internal allocator if it was
already initializated.

If the stream changes, then either one will be unref and a new
allocator is created.
This commit is contained in:
Víctor Manuel Jáquez Leal 2020-01-27 18:40:46 +01:00
parent 9fa177951e
commit 4778882728

View file

@ -162,8 +162,14 @@ gst_vaapi_video_buffer_pool_set_config (GstBufferPool * pool,
if (allocator
&& (g_strcmp0 (allocator->mem_type, GST_VAAPI_VIDEO_MEMORY_NAME) != 0
&& g_strcmp0 (allocator->mem_type,
GST_VAAPI_DMABUF_ALLOCATOR_NAME) != 0))
allocator = NULL;
GST_VAAPI_DMABUF_ALLOCATOR_NAME) != 0)) {
/* if pool has already an allocator, try it and ignore the one in
* configuration */
if (priv->allocator)
allocator = priv->allocator;
else
allocator = NULL;
}
/* get the allocator properties */
if (allocator) {