From abe5a06421f294f10bb468045d0b54d9beb7293a Mon Sep 17 00:00:00 2001 From: Edward Hervey <edward@centricular.com> Date: Fri, 8 Jul 2022 10:40:33 +0200 Subject: [PATCH] adaptivedemux2: Handle synchronously to lost sync We are already in the main scheduler thread, therefore we can do the "seek back to live" directly. This also avoids other pending actions to take place. Also handle the loss of sync when doing manifest updates. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2839> --- .../ext/adaptivedemux2/gstadaptivedemux-stream.c | 3 +-- .../gst-plugins-good/ext/adaptivedemux2/gstadaptivedemux.c | 3 +++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/subprojects/gst-plugins-good/ext/adaptivedemux2/gstadaptivedemux-stream.c b/subprojects/gst-plugins-good/ext/adaptivedemux2/gstadaptivedemux-stream.c index c9dc24f81d..6f8f575846 100644 --- a/subprojects/gst-plugins-good/ext/adaptivedemux2/gstadaptivedemux-stream.c +++ b/subprojects/gst-plugins-good/ext/adaptivedemux2/gstadaptivedemux-stream.c @@ -1731,8 +1731,7 @@ gst_adaptive_demux2_stream_load_a_fragment (GstAdaptiveDemux2Stream * stream) case GST_ADAPTIVE_DEMUX_FLOW_LOST_SYNC: GST_DEBUG_OBJECT (stream, "Lost sync, asking reset to current position"); stream->state = GST_ADAPTIVE_DEMUX2_STREAM_STATE_STOPPED; - gst_adaptive_demux_loop_call (demux->priv->scheduler_task, - (GSourceFunc) gst_adaptive_demux_handle_lost_sync, demux, NULL); + gst_adaptive_demux_handle_lost_sync (demux); return FALSE; case GST_FLOW_NOT_LINKED: { diff --git a/subprojects/gst-plugins-good/ext/adaptivedemux2/gstadaptivedemux.c b/subprojects/gst-plugins-good/ext/adaptivedemux2/gstadaptivedemux.c index d6cc370a43..f17f6c4964 100644 --- a/subprojects/gst-plugins-good/ext/adaptivedemux2/gstadaptivedemux.c +++ b/subprojects/gst-plugins-good/ext/adaptivedemux2/gstadaptivedemux.c @@ -3157,6 +3157,9 @@ gst_adaptive_demux_manifest_update_cb (GstAdaptiveDemux * demux) } } + if (ret == GST_ADAPTIVE_DEMUX_FLOW_LOST_SYNC) + gst_adaptive_demux_handle_lost_sync (demux); + if (schedule_again) { GstAdaptiveDemuxClass *klass = GST_ADAPTIVE_DEMUX_GET_CLASS (demux);