From 9667f0e4728cbfad6113668011e7b210050adc95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Manuel=20J=C3=A1quez=20Leal?= Date: Fri, 13 May 2016 13:14:23 +0200 Subject: [PATCH] plugins: destroy pool earlier if non-vaapi If the offered pool in decide_allocation() vmethod doesn't have the VAAPI_VIDEO_META option, it is destroyed immediatly and the pointer cleared, so it could be created later. --- gst/vaapi/gstvaapipluginbase.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/gst/vaapi/gstvaapipluginbase.c b/gst/vaapi/gstvaapipluginbase.c index 000e326e52..f7fc2eed9c 100644 --- a/gst/vaapi/gstvaapipluginbase.c +++ b/gst/vaapi/gstvaapipluginbase.c @@ -719,6 +719,14 @@ gst_vaapi_plugin_base_decide_allocation (GstVaapiPluginBase * plugin, not provide a correct propose_allocation() implementation */ has_video_alignment = gst_buffer_pool_has_option (pool, GST_BUFFER_POOL_OPTION_VIDEO_ALIGNMENT); + + /* GstVaapiVideoMeta is mandatory, and this implies VA surface memory */ + if (!gst_buffer_pool_has_option (pool, + GST_BUFFER_POOL_OPTION_VAAPI_VIDEO_META)) { + GST_INFO_OBJECT (plugin, "ignoring non-VAAPI pool: %" GST_PTR_FORMAT, + pool); + g_clear_object (&pool); + } } } else { pool = NULL; @@ -726,13 +734,7 @@ gst_vaapi_plugin_base_decide_allocation (GstVaapiPluginBase * plugin, min = max = 0; } - /* GstVaapiVideoMeta is mandatory, and this implies VA surface memory */ - if (!pool || !gst_buffer_pool_has_option (pool, - GST_BUFFER_POOL_OPTION_VAAPI_VIDEO_META)) { - GST_INFO_OBJECT (plugin, "%s. Making a new pool", pool == NULL ? "No pool" : - "Pool hasn't GstVaapiVideoMeta"); - if (pool) - gst_object_unref (pool); + if (!pool) { pool = gst_vaapi_video_buffer_pool_new (plugin->display); if (!pool) goto error_create_pool;