From 74a7baa533becced404b13fc99a34860fbfc2c02 Mon Sep 17 00:00:00 2001 From: Nicolas Dufresne Date: Mon, 19 Sep 2016 12:08:20 -0400 Subject: waylandsink: Don't propose multiple time the same buffer pool The buffer pool API does not allow multiple of owner. This otherwise lead to error when renegotiation take place. Aso consider the allocation query "need_pool" boolean. --- ext/wayland/gstwaylandsink.c | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/ext/wayland/gstwaylandsink.c b/ext/wayland/gstwaylandsink.c index 41b9ca7cd..225b74008 100644 --- a/ext/wayland/gstwaylandsink.c +++ b/ext/wayland/gstwaylandsink.c @@ -518,18 +518,29 @@ static gboolean gst_wayland_sink_propose_allocation (GstBaseSink * bsink, GstQuery * query) { GstWaylandSink *sink = GST_WAYLAND_SINK (bsink); + GstCaps *caps; + GstBufferPool *pool = NULL; GstStructure *config; guint size, min_bufs, max_bufs; + gboolean need_pool; - config = gst_buffer_pool_get_config (sink->pool); - gst_buffer_pool_config_get_params (config, NULL, &size, &min_bufs, &max_bufs); + gst_query_parse_allocation (query, &caps, &need_pool); - /* we do have a pool for sure (created in set_caps), - * so let's propose it anyway, but also propose the allocator on its own */ - gst_query_add_allocation_pool (query, sink->pool, size, min_bufs, max_bufs); - gst_query_add_allocation_param (query, gst_wl_shm_allocator_get (), NULL); + if (need_pool) + pool = gst_wayland_create_pool (sink, caps); + + if (pool) { + config = gst_buffer_pool_get_config (pool); + gst_buffer_pool_config_get_params (config, NULL, &size, &min_bufs, + &max_bufs); + gst_query_add_allocation_pool (query, pool, size, min_bufs, max_bufs); - gst_structure_free (config); + gst_structure_free (config); + g_object_unref (pool); + } + + gst_query_add_allocation_param (query, gst_wl_shm_allocator_get (), NULL); + gst_query_add_allocation_meta (query, GST_VIDEO_META_API_TYPE, NULL); return TRUE; } -- cgit v1.2.1