mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 12:11:13 +00:00
audiobasesrc: always acquire if not acquired in _setcaps
audiobasesrc's setcaps contains an optimization that makes it not re- acquire the ringbuffer if the caps have not changed. However, it doesn't check if it has successfully acquired it or not. It's possible to have the caps set but not having ringbuffer acquired if the previous attempt to acquire fails. This commit replaces the caps existence check with whether the ringbuffer is acquired or not. There's no need to check for caps existence because 1.) it's unlikely to be NULL if the ringbuffer is acquired, and 2.) _setcaps shouldn't be called with a NULL caps. This should also let the element retry on acquiring ringbuffer after an error by re-setting the element's state to READY and back to PLAYING. Whether this behavior is correct is up for debate. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/512>
This commit is contained in:
parent
6ffddd27e5
commit
cc8f54468e
1 changed files with 2 additions and 1 deletions
|
@ -513,7 +513,8 @@ gst_audio_base_src_setcaps (GstBaseSrc * bsrc, GstCaps * caps)
|
||||||
|
|
||||||
spec = &src->ringbuffer->spec;
|
spec = &src->ringbuffer->spec;
|
||||||
|
|
||||||
if (G_UNLIKELY (spec->caps && gst_caps_is_equal (spec->caps, caps))) {
|
if (G_UNLIKELY (gst_audio_ring_buffer_is_acquired (src->ringbuffer)
|
||||||
|
&& gst_caps_is_equal (spec->caps, caps))) {
|
||||||
GST_DEBUG_OBJECT (src,
|
GST_DEBUG_OBJECT (src,
|
||||||
"Ringbuffer caps haven't changed, skipping reconfiguration");
|
"Ringbuffer caps haven't changed, skipping reconfiguration");
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
Loading…
Reference in a new issue