screen-cast/stream-src: Fix stride and max buffer size calculation
- Centralize stride calculation in one function.
- For dmabufs query the stride instead of assuming a certain value.
- For system memory buffers use the pixel format to calculate the stride.
- Stop negotiating
SPA_PARAM_BUFFERS_size
andSPA_PARAM_BUFFERS_stride
. - Clean up variables, notably
spa_data
.
2 fixes an actual bug where we reported wrong max buffer sizes, resulting in crashes in Gstreamer when doing area screencasts on AMD GPUs.
The reasoning for 4. is that the values were possibly wrong for dmabufs as the negotiation happens before we create any buffers. Further more neither Mutter nor the common consumers required it. The later either ignore the values (OBS), always accept (gstpipewiresrc) them or calculate the exact same possibly wrong values (libwebrtc).
Closes: gnome-shell#6747 (closed)
Edited by Robert Mader