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: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7903>
This commit is contained in:
Nicolas Dufresne 2024-11-07 12:49:10 -05:00
parent c67ac844ed
commit f9c01f6479
2 changed files with 14 additions and 10 deletions

View file

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

View file

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