audiobasesrc: always acquire if not acquired in _setcaps
authorRatchanan Srirattanamet <ratchanan@ubports.com>
Thu, 5 Dec 2019 13:08:36 +0000 (20:08 +0700)
committerGStreamer Merge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Fri, 4 Dec 2020 13:57:58 +0000 (13:57 +0000)
commitcc8f54468e47468bed387f19e12d871907cc6356
tree1a9c7e7b6a442ea3521b62a1afe3c0669588e858
parent6ffddd27e5216a142bfd882c5375f0816303b136
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>
gst-libs/gst/audio/gstaudiobasesrc.c