OBS Studio - Free and open source software for live streaming and screen recording
linux-pulseaudio: fix race conditions
PulseAudio code needs to be called with the PA lock held. This chiefly fixes multiple races during stream shutdown: * If the functions are called without the lock held, deferred event handling races end up with PA infinite looping on the mainloop, or asserting, or other badness, as the reentrant calls cause data structure corruption on the PA side. * If we don't reset our callbacks, PA might call us even after we request stream disconnection (since the stream actually getting fully shut down is asynchronous), and then we dereference NULL pointers from our userdata etc. PA will keep its data structures alive until necessary via reference counting, but not ours. The lock around pa_stream_begin_write doesn't result from any issues I experienced, but it looks correct; PA doesn't say anywhere that that function is thread-safe.
H
Hector Martin committed
a5d08e347e4fe938dcd27c50800e08554cd7fe93
Parent: f17ea5d
Committed by Jim <obs.jim@gmail.com>
on 12/12/2020, 8:05:12 PM