SIGSEV on queuing buffer, when the size of the buffer was renegotiated
Changing the size of the buffers in fast sucession, while the consumer is still processing the buffer can result in a segvault of the consumer at queueing a buffer with old dimensions.
Setup: Screencasting the whole desktop (sway, xdg-desktop-portal-wlr) from obs (obs-xdg-portal) while changing the resolution of the desktop rapidly results in a segvault of obs.
This script was used to change the resolution pw-reneg.sh
Logs:
$ PIPEWIRE_DEBUG=5 PIPEWIRE_LOG=./pw-reneg.log gdb obs
pipewire: pw-reneg.log
obs gdb:
--Type <RET> for more, q to quit, c to continue without paging--
Thread 29 "libobs: graphic" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fff67d07640 (LWP 61237)]
0x00007fffa81c10f5 in pw_stream_queue_buffer () from /usr/lib/libpipewire-0.3.so.0
(gdb) bt
#0 0x00007fffa81c10f5 in pw_stream_queue_buffer () at /usr/lib/libpipewire-0.3.so.0
#1 0x00007fff84015621 in obs_pipewire_video_render () at /usr//lib/obs-plugins/obs-xdg-portal.so
#2 0x00007ffff5bf15e9 in obs_source_default_render () at /usr/lib/libobs.so.0
#3 0x00007ffff5bf5f7c in obs_source_video_render () at /usr/lib/libobs.so.0
#4 0x00007ffff5c2b7fa in () at /usr/lib/libobs.so.0
#5 0x00007ffff5bf5e40 in obs_source_video_render () at /usr/lib/libobs.so.0
#6 0x00007ffff5bfcb26 in obs_transition_video_render () at /usr/lib/libobs.so.0
#7 0x00007ffff5bf5e40 in obs_source_video_render () at /usr/lib/libobs.so.0
#8 0x00007ffff5c28285 in obs_view_render () at /usr/lib/libobs.so.0
#9 0x00007ffff5c30b9c in obs_graphics_thread_loop () at /usr/lib/libobs.so.0
#10 0x00007ffff5c31fb9 in obs_graphics_thread () at /usr/lib/libobs.so.0
#11 0x00007ffff4c0e299 in start_thread () at /usr/lib/libpthread.so.0
#12 0x00007ffff4b37053 in clone () at /usr/lib/libc.so.6
(gdb)