From f9c01f64794257846ee9960270a0b6f852da60f0 Mon Sep 17 00:00:00 2001 From: Nicolas Dufresne Date: Thu, 7 Nov 2024 12:49:10 -0500 Subject: [PATCH] waylandsink: Do not offer SHM pool when DMABuf is negotiated Pools are expected to produce DMABuf when the caps are negotiated with the associated caps feature. For that reason, avoid sharing the SHM pool in this case. Part-of: --- .../gst-plugins-bad/ext/gtk/gstgtkwaylandsink.c | 12 +++++++----- .../gst-plugins-bad/ext/wayland/gstwaylandsink.c | 12 +++++++----- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/subprojects/gst-plugins-bad/ext/gtk/gstgtkwaylandsink.c b/subprojects/gst-plugins-bad/ext/gtk/gstgtkwaylandsink.c index 8fcbabe494..f038cca0cc 100644 --- a/subprojects/gst-plugins-bad/ext/gtk/gstgtkwaylandsink.c +++ b/subprojects/gst-plugins-bad/ext/gtk/gstgtkwaylandsink.c @@ -1038,11 +1038,10 @@ gst_gtk_wayland_sink_propose_allocation (GstBaseSink * bsink, GstQuery * query) GstCaps *caps; GstBufferPool *pool = NULL; gboolean need_pool; - GstAllocator *alloc; gst_query_parse_allocation (query, &caps, &need_pool); - if (need_pool) { + if (need_pool && !gst_video_is_dma_drm_caps (caps)) { GstStructure *config; pool = gst_wl_video_buffer_pool_new (); config = gst_buffer_pool_get_config (pool); @@ -1057,10 +1056,13 @@ gst_gtk_wayland_sink_propose_allocation (GstBaseSink * bsink, GstQuery * query) if (pool) g_object_unref (pool); - alloc = gst_shm_allocator_get (); - gst_query_add_allocation_param (query, alloc, NULL); + if (!gst_video_is_dma_drm_caps (caps)) { + GstAllocator *alloc = gst_shm_allocator_get (); + gst_query_add_allocation_param (query, alloc, NULL); + g_object_unref (alloc); + } + gst_query_add_allocation_meta (query, GST_VIDEO_META_API_TYPE, NULL); - g_object_unref (alloc); return TRUE; } diff --git a/subprojects/gst-plugins-bad/ext/wayland/gstwaylandsink.c b/subprojects/gst-plugins-bad/ext/wayland/gstwaylandsink.c index a6613a103f..21b183a472 100644 --- a/subprojects/gst-plugins-bad/ext/wayland/gstwaylandsink.c +++ b/subprojects/gst-plugins-bad/ext/wayland/gstwaylandsink.c @@ -790,7 +790,6 @@ gst_wayland_sink_propose_allocation (GstBaseSink * bsink, GstQuery * query) GstCaps *caps; GstBufferPool *pool = NULL; gboolean need_pool; - GstAllocator *alloc; GstVideoInfoDmaDrm drm_info; GstVideoInfo vinfo; guint size; @@ -811,7 +810,7 @@ gst_wayland_sink_propose_allocation (GstBaseSink * bsink, GstQuery * query) size = vinfo.size; } - if (need_pool) { + if (need_pool && !gst_video_is_dma_drm_caps (caps)) { GstStructure *config; pool = gst_wl_video_buffer_pool_new (); config = gst_buffer_pool_get_config (pool); @@ -825,10 +824,13 @@ gst_wayland_sink_propose_allocation (GstBaseSink * bsink, GstQuery * query) if (pool) g_object_unref (pool); - alloc = gst_shm_allocator_get (); - gst_query_add_allocation_param (query, alloc, NULL); + if (!gst_video_is_dma_drm_caps (caps)) { + GstAllocator *alloc = gst_shm_allocator_get (); + gst_query_add_allocation_param (query, alloc, NULL); + g_object_unref (alloc); + } + gst_query_add_allocation_meta (query, GST_VIDEO_META_API_TYPE, NULL); - g_object_unref (alloc); return TRUE; }