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
This commit is contained in:
Julien Isorce 2016-10-19 15:15:01 +01:00 committed by Víctor Manuel Jáquez Leal
parent e265788271
commit aca43dab47

View file

@ -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;