From c0826fdc96d9fca6d0e203e8c23c2b400be5c31a Mon Sep 17 00:00:00 2001 From: Víctor Manuel Jáquez Leal Date: Thu, 8 Feb 2018 11:33:26 +0100 Subject: plugins: handle vaapi allocator in allocation query In propose_allocation() if the numer of allocation params is zero, the system's allocator is added first, and lastly the native VA-API allocator. https://bugzilla.gnome.org/show_bug.cgi?id=789476 --- gst/vaapi/gstvaapipluginbase.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/gst/vaapi/gstvaapipluginbase.c b/gst/vaapi/gstvaapipluginbase.c index 4f43b6c0..738f8b6d 100644 --- a/gst/vaapi/gstvaapipluginbase.c +++ b/gst/vaapi/gstvaapipluginbase.c @@ -819,14 +819,28 @@ gst_vaapi_plugin_base_propose_allocation (GstVaapiPluginBase * plugin, if (!caps) goto error_no_caps; + if (!ensure_sinkpad_buffer_pool (plugin, caps)) + return FALSE; + if (need_pool) { - if (!ensure_sinkpad_buffer_pool (plugin, caps)) - return FALSE; gst_query_add_allocation_pool (query, plugin->sinkpad_buffer_pool, plugin->sinkpad_buffer_size, BUFFER_POOL_SINK_MIN_BUFFERS, 0); - gst_query_add_allocation_param (query, plugin->sinkpad_allocator, NULL); } + /* Set sinkpad allocator as the last allocation param. + * + * If there's none, set system's allocator first and VAAPI allocator + * second + */ + if (gst_query_get_n_allocation_params (query) == 0) { + GstAllocator *allocator; + + allocator = gst_allocator_find (GST_ALLOCATOR_SYSMEM); + gst_query_add_allocation_param (query, allocator, NULL); + gst_object_unref (allocator); + } + gst_query_add_allocation_param (query, plugin->sinkpad_allocator, NULL); + gst_query_add_allocation_meta (query, GST_VAAPI_VIDEO_META_API_TYPE, NULL); gst_query_add_allocation_meta (query, GST_VIDEO_META_API_TYPE, NULL); return TRUE; -- cgit v1.2.3