summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVíctor Manuel Jáquez Leal <vjaquez@igalia.com>2020-01-27 18:40:46 +0100
committerVíctor Manuel Jáquez Leal <vjaquez@igalia.com>2020-01-27 20:31:12 +0000
commit477888272867b112ef1b19f0ee925adae973f92e (patch)
tree6bbcbbb573b4f88205c7865000494f4f0b582e78
parent9fa177951ecd05222c0310c0bd6c0fdcb8836f6b (diff)
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.
-rw-r--r--gst/vaapi/gstvaapivideobufferpool.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/gst/vaapi/gstvaapivideobufferpool.c b/gst/vaapi/gstvaapivideobufferpool.c
index cbc8a1b3..432de681 100644
--- a/gst/vaapi/gstvaapivideobufferpool.c
+++ b/gst/vaapi/gstvaapivideobufferpool.c
@@ -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) {