From aca43dab4773e7bdf92f2d70066a53541432522f Mon Sep 17 00:00:00 2001 From: Julien Isorce Date: Wed, 19 Oct 2016 15:15:01 +0100 Subject: [PATCH] vaapivideobufferpool: set correct buffer size We should set the correct buffer size when we are configuring the pool, otherwise the buffer will be discarded when it returns to the pool. Indeed when the ref-count of a buffer reaches zero, its pool will queue it back (and ref it) if, and only if, the buffer size matches the configured buffer size on the pool. This issue can be debugged with GST_DEBUG=*PERF*:6, see gstbufferpool.c https://bugzilla.gnome.org/show_bug.cgi?id=774782 --- gst/vaapi/gstvaapivideobufferpool.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/gst/vaapi/gstvaapivideobufferpool.c b/gst/vaapi/gstvaapivideobufferpool.c index a3b9223f24..a97fa558d1 100644 --- a/gst/vaapi/gstvaapivideobufferpool.c +++ b/gst/vaapi/gstvaapivideobufferpool.c @@ -140,11 +140,13 @@ gst_vaapi_video_buffer_pool_set_config (GstBufferPool * pool, GstVideoAlignment align; GstAllocator *allocator; gboolean ret, updated = FALSE; + guint size, min_buffers, max_buffers; GST_DEBUG_OBJECT (pool, "config %" GST_PTR_FORMAT, config); caps = NULL; - if (!gst_buffer_pool_config_get_params (config, &caps, NULL, NULL, NULL)) + if (!gst_buffer_pool_config_get_params (config, &caps, &size, &min_buffers, + &max_buffers)) goto error_invalid_config; if (!caps) goto error_no_caps; @@ -177,6 +179,10 @@ gst_vaapi_video_buffer_pool_set_config (GstBufferPool * pool, goto error_create_allocator_info; priv->alloc_info = *alloc_vip; } + if (GST_VIDEO_INFO_SIZE (&priv->alloc_info) != size) { + gst_buffer_pool_config_set_params (config, caps, + GST_VIDEO_INFO_SIZE (&priv->alloc_info), min_buffers, max_buffers); + } } if (!priv->allocator) goto error_no_allocator;