gst: update buffer size only if format defines a size

For encoded formats, p->video_info.size will be 0. If the pipewiresrc
handles an encoded format, the bufferpool will be configured to allocate
buffers of size 0. This will cause errors later when trying to copy the
frames into the pipewire buffers.

Update the bufferpool size only if video_info defines an actual buffer
size.
This commit is contained in:
Michael Tretter 2023-10-27 16:50:06 +02:00
parent bd15e5275b
commit efa08e9892

View file

@ -228,7 +228,10 @@ set_config (GstBufferPool * pool, GstStructure * config)
p->add_metavideo = has_video && gst_buffer_pool_config_has_option (config,
GST_BUFFER_POOL_OPTION_VIDEO_META);
gst_buffer_pool_config_set_params (config, caps, p->video_info.size, min_buffers, max_buffers);
if (p->video_info.size != 0)
size = p->video_info.size;
gst_buffer_pool_config_set_params (config, caps, size, min_buffers, max_buffers);
return GST_BUFFER_POOL_CLASS (gst_pipewire_pool_parent_class)->set_config (pool, config);
}