From cb25b1e95ec9f5e9a52d9ee1927d55718ac4aa11 Mon Sep 17 00:00:00 2001 From: Edward Hervey Date: Thu, 3 Oct 2024 17:07:59 +0200 Subject: [PATCH] uridecodebin3: Use lock when checking input/output items Otherwise there is the risk that the play items list could have changed in between Part-of: --- .../gst/playback/gsturidecodebin3.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/subprojects/gst-plugins-base/gst/playback/gsturidecodebin3.c b/subprojects/gst-plugins-base/gst/playback/gsturidecodebin3.c index 82fdd867e9..edd49d0505 100644 --- a/subprojects/gst-plugins-base/gst/playback/gsturidecodebin3.c +++ b/subprojects/gst-plugins-base/gst/playback/gsturidecodebin3.c @@ -675,10 +675,19 @@ db_src_probe (GstPad * pad, GstPadProbeInfo * info, OutputPad * output) switch (GST_EVENT_TYPE (event)) { case GST_EVENT_EOS: { + gboolean drop_event = FALSE; + GstPlayItem *last; + + PLAY_ITEMS_LOCK (uridecodebin); + last = g_list_last (uridecodebin->play_items)->data; + /* If there is a next input, drop the EOS event */ if (uridecodebin->input_item != uridecodebin->output_item || - uridecodebin->input_item != - g_list_last (uridecodebin->play_items)->data) { + uridecodebin->input_item != last) { + drop_event = TRUE; + } + PLAY_ITEMS_UNLOCK (uridecodebin); + if (drop_event) { GST_DEBUG_OBJECT (uridecodebin, "Dropping EOS event because in gapless mode"); return GST_PAD_PROBE_DROP;