From e506f9c23e8ddaffa3f383fee77bae4340f81662 Mon Sep 17 00:00:00 2001 From: soak Date: Mon, 3 Jul 2023 11:48:57 -0400 Subject: [PATCH] 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: --- subprojects/gstreamer/libs/gst/base/gstbasesrc.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/subprojects/gstreamer/libs/gst/base/gstbasesrc.c b/subprojects/gstreamer/libs/gst/base/gstbasesrc.c index 5f66a3d26a..6ac5e4d89d 100644 --- a/subprojects/gstreamer/libs/gst/base/gstbasesrc.c +++ b/subprojects/gstreamer/libs/gst/base/gstbasesrc.c @@ -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;