diff options
author | Nicolas Dufresne <nicolas.dufresne@collabora.com> | 2016-09-19 12:08:20 -0400 |
---|---|---|
committer | Nicolas Dufresne <nicolas.dufresne@collabora.com> | 2016-09-21 11:02:40 -0400 |
commit | 74a7baa533becced404b13fc99a34860fbfc2c02 (patch) | |
tree | fd093e1db662cf339ff1629f039586c876909bf2 | |
parent | 9357047eaf9460d76974cc781229a35789192cf1 (diff) |
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.
-rw-r--r-- | ext/wayland/gstwaylandsink.c | 25 |
1 files 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; } |