Skip to content

gst: avoid crash with zero SPA_PARAM_BUFFERS_size

Jakub Adam requested to merge xhaakon/pipewire:fix-crash into master

With sending and receiving pipelines:

gst-launch videotestsrc ! tee ! pipewiresink mode=provide

gst-launch pipewiresrc path=<node_id> ! videoconvert ! autovideosink

The first pipeline crashes when the other connects.

It happens because SPA_PARAM_BUFFERS_size passed to pw_stream_update_params() upon pipewiresink's buffer pool activation is zero. As a consequence, in gst_pipewire_pool_wrap_buffer(), d->type will be SPA_ID_INVALID and the created GstBuffer will have no memory appended. This ultimately leads to segfault in do_send_buffer().

If size hasn't been set in GstPipeWirePool's config before the first buffer is to be rendered by pipewiresink, configure the pool with the size of that first incoming buffer and activate the pool.

Merge request reports