mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-26 03:31:05 +00:00
waylandsink: config buffer pool with query size when propose_allocation
If propose_allocation comes before set_caps, self->video_info has not been extracted from caps and self->video_info.size is 0. It causes buffer pool fail to set config . So need to use info size got from query instead when propose_allocation. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6666>
This commit is contained in:
parent
750d53d7e0
commit
4dfdaf67db
1 changed files with 19 additions and 4 deletions
|
@ -758,26 +758,41 @@ unsupported_format:
|
|||
static gboolean
|
||||
gst_wayland_sink_propose_allocation (GstBaseSink * bsink, GstQuery * query)
|
||||
{
|
||||
GstWaylandSink *self = GST_WAYLAND_SINK (bsink);
|
||||
GstCaps *caps;
|
||||
GstBufferPool *pool = NULL;
|
||||
gboolean need_pool;
|
||||
GstAllocator *alloc;
|
||||
GstVideoInfoDmaDrm drm_info;
|
||||
GstVideoInfo vinfo;
|
||||
guint size;
|
||||
|
||||
gst_query_parse_allocation (query, &caps, &need_pool);
|
||||
|
||||
if (caps == NULL)
|
||||
return FALSE;
|
||||
|
||||
if (gst_video_is_dma_drm_caps (caps)) {
|
||||
if (!gst_video_info_dma_drm_from_caps (&drm_info, caps))
|
||||
return FALSE;
|
||||
size = drm_info.vinfo.size;
|
||||
} else {
|
||||
/* extract info from caps */
|
||||
if (!gst_video_info_from_caps (&vinfo, caps))
|
||||
return FALSE;
|
||||
size = vinfo.size;
|
||||
}
|
||||
|
||||
if (need_pool) {
|
||||
GstStructure *config;
|
||||
pool = gst_wl_video_buffer_pool_new ();
|
||||
config = gst_buffer_pool_get_config (pool);
|
||||
gst_buffer_pool_config_set_params (config,
|
||||
caps, self->video_info.size, 2, 0);
|
||||
gst_buffer_pool_config_set_params (config, caps, size, 2, 0);
|
||||
gst_buffer_pool_config_set_allocator (config,
|
||||
gst_shm_allocator_get (), NULL);
|
||||
gst_buffer_pool_set_config (pool, config);
|
||||
}
|
||||
|
||||
gst_query_add_allocation_pool (query, pool, self->video_info.size, 2, 0);
|
||||
gst_query_add_allocation_pool (query, pool, size, 2, 0);
|
||||
if (pool)
|
||||
g_object_unref (pool);
|
||||
|
||||
|
|
Loading…
Reference in a new issue