From c5824f1b4306be249e56ff7feeafa6222cf46465 Mon Sep 17 00:00:00 2001 From: Nicolas Dufresne Date: Thu, 12 Mar 2015 16:32:31 +0000 Subject: [PATCH] videopool: Choose the biggest buffer size We should respect what has been negotiated. --- gst-libs/gst/video/gstvideopool.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/gst-libs/gst/video/gstvideopool.c b/gst-libs/gst/video/gstvideopool.c index 71bd562..6b9d7dd 100644 --- a/gst-libs/gst/video/gstvideopool.c +++ b/gst-libs/gst/video/gstvideopool.c @@ -138,6 +138,9 @@ video_buffer_pool_set_config (GstBufferPool * pool, GstStructure * config) if (!gst_video_info_from_caps (&info, caps)) goto wrong_caps; + if (size < info.size) + goto wrong_size; + if (!gst_buffer_pool_config_get_allocator (config, &allocator, ¶ms)) goto wrong_config; @@ -172,6 +175,7 @@ video_buffer_pool_set_config (GstBufferPool * pool, GstStructure * config) gst_buffer_pool_config_set_video_alignment (config, &priv->video_align); } priv->info = info; + info.size = MAX (size, info.size); gst_buffer_pool_config_set_params (config, caps, info.size, min_buffers, max_buffers); @@ -195,6 +199,13 @@ wrong_caps: "failed getting geometry from caps %" GST_PTR_FORMAT, caps); return FALSE; } +wrong_size: + { + GST_WARNING_OBJECT (pool, + "Provided size is to small for the caps: %u", size); + return FALSE; + + } } static GstFlowReturn -- 2.7.4