audio: Make sure to stop ringbuffer on error
authorJan Schmidt <jan@centricular.com>
Fri, 18 Aug 2023 15:00:16 +0000 (01:00 +1000)
committerTim-Philipp Müller <tim@centricular.com>
Mon, 21 Aug 2023 18:22:53 +0000 (19:22 +0100)
commitdf9482f39bdbb31e77bb32aca865c0f37d5dab6c
tree0da65c58c8573d5cae8c120cf03118f6888ad36c
parent1347f71b6dfa5d44bec3d15c1c1a5df7c929f62d
audio: Make sure to stop ringbuffer on error

Add gst_audio_ring_buffer_set_errored() that will mark the
ringbuffer as errored only if it is currently started or paused,
so gst_audio_ringbuffer_stop() can be sure that the error
state means that the ringbuffer was started and needs stop called.

Fixes a crash with osxaudiosrc if the source element posts
an error, because the ringbuffer would not get stopped and CoreAudio
would continue trying to do callbacks.

Also, anywhere that modifies the ringbuffer state, make sure to
use atomic operations, to guarantee their visibility

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5216>
subprojects/gst-plugins-base/gst-libs/gst/audio/gstaudiobasesrc.c
subprojects/gst-plugins-base/gst-libs/gst/audio/gstaudioringbuffer.c