basesrc: Restore pause/resume in derived classes

When the pipeline goes from Playing to Paused, this change will invoke
unlock in the derived class. When the pipeline goes from Paused to
Playing, this change will invoke unlock_stop in the derived class.

This feature was removed in commit 523de1a9 and is now being restored.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4961>
This commit is contained in:
soak 2023-07-03 11:48:57 -04:00 committed by GStreamer Marge Bot
parent 6dd0019090
commit e506f9c23e

View file

@ -3845,12 +3845,23 @@ gst_base_src_set_flushing (GstBaseSrc * basesrc, gboolean flushing)
static gboolean
gst_base_src_set_playing (GstBaseSrc * basesrc, gboolean live_play)
{
GstBaseSrcClass *bclass;
bclass = GST_BASE_SRC_GET_CLASS (basesrc);
/* we are now able to grab the LIVE lock, when we get it, we can be
* waiting for PLAYING while blocked in the LIVE cond or we can be waiting
* for the clock. */
GST_LIVE_LOCK (basesrc);
GST_DEBUG_OBJECT (basesrc, "unschedule clock");
/* unlock subclasses locked in ::create, we only do this when we stop playing. */
if (!live_play) {
GST_DEBUG_OBJECT (basesrc, "unlock");
if (bclass->unlock)
bclass->unlock (basesrc);
}
/* unblock clock sync (if any) */
if (basesrc->clock_id)
gst_clock_id_unschedule (basesrc->clock_id);
@ -3862,6 +3873,11 @@ gst_base_src_set_playing (GstBaseSrc * basesrc, gboolean live_play)
if (live_play) {
gboolean start;
/* clear our unlock request when going to PLAYING */
GST_DEBUG_OBJECT (basesrc, "unlock stop");
if (bclass->unlock_stop)
bclass->unlock_stop (basesrc);
/* for live sources we restart the timestamp correction */
GST_OBJECT_LOCK (basesrc);
basesrc->priv->latency = -1;