From ad705cc5a3d45e70d2b1cb71698ebafe3c91cdc8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Manuel=20J=C3=A1quez=20Leal?= Date: Thu, 15 Feb 2018 19:22:08 +0100 Subject: [PATCH] vaapibufferpool: don't change config when forcing video meta VA-API based buffer might need a video meta because of different strides. But when donwstream doesn't support video meta we need to force the usage of video meta. Before we changed the buffer pool configuration, but actually this is a hack and we cannot rely on that for downstream. This patch add a check fo raw video caps and allocator is VA-API, then the option is enabled without changing the pool configuration. In this case the element is responsible to copy the frame to a simple buffer with the expected strides. https://bugzilla.gnome.org/show_bug.cgi?id=785054 --- gst/vaapi/gstvaapivideobufferpool.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/gst/vaapi/gstvaapivideobufferpool.c b/gst/vaapi/gstvaapivideobufferpool.c index f4b1a42f68..812893ba16 100644 --- a/gst/vaapi/gstvaapivideobufferpool.c +++ b/gst/vaapi/gstvaapivideobufferpool.c @@ -142,7 +142,7 @@ gst_vaapi_video_buffer_pool_set_config (GstBufferPool * pool, const GstVideoInfo *negotiated_vinfo; GstVideoAlignment align; GstAllocator *allocator; - gboolean ret, updated = FALSE; + gboolean ret; guint size, min_buffers, max_buffers; guint surface_alloc_flags; @@ -248,17 +248,16 @@ gst_vaapi_video_buffer_pool_set_config (GstBufferPool * pool, if (gst_buffer_pool_config_has_option (config, GST_BUFFER_POOL_OPTION_VIDEO_META)) { priv->options |= GST_VAAPI_VIDEO_BUFFER_POOL_OPTION_VIDEO_META; - } else { + } else if (gst_caps_is_video_raw (caps) && !priv->use_dmabuf_memory) { gint i; + for (i = 0; i < GST_VIDEO_INFO_N_PLANES (&new_allocation_vinfo); i++) { if (GST_VIDEO_INFO_PLANE_OFFSET (&new_allocation_vinfo, i) != GST_VIDEO_INFO_PLANE_OFFSET (&priv->vmeta_vinfo, i) || GST_VIDEO_INFO_PLANE_STRIDE (&new_allocation_vinfo, i) != GST_VIDEO_INFO_PLANE_STRIDE (&priv->vmeta_vinfo, i)) { priv->options |= GST_VAAPI_VIDEO_BUFFER_POOL_OPTION_VIDEO_META; - gst_buffer_pool_config_add_option (config, - GST_BUFFER_POOL_OPTION_VIDEO_META); - updated = TRUE; + GST_INFO_OBJECT (pool, "adding unrequested video meta"); break; } } @@ -277,7 +276,7 @@ gst_vaapi_video_buffer_pool_set_config (GstBufferPool * pool, ret = GST_BUFFER_POOL_CLASS (gst_vaapi_video_buffer_pool_parent_class)->set_config (pool, config); - return !updated && ret; + return ret; /* ERRORS */ error_invalid_config: