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: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7609>
This commit is contained in:
Edward Hervey 2024-10-03 17:07:59 +02:00 committed by GStreamer Marge Bot
parent e1e48b9fea
commit cb25b1e95e

View file

@ -675,10 +675,19 @@ db_src_probe (GstPad * pad, GstPadProbeInfo * info, OutputPad * output)
switch (GST_EVENT_TYPE (event)) { switch (GST_EVENT_TYPE (event)) {
case GST_EVENT_EOS: 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 there is a next input, drop the EOS event */
if (uridecodebin->input_item != uridecodebin->output_item || if (uridecodebin->input_item != uridecodebin->output_item ||
uridecodebin->input_item != uridecodebin->input_item != last) {
g_list_last (uridecodebin->play_items)->data) { drop_event = TRUE;
}
PLAY_ITEMS_UNLOCK (uridecodebin);
if (drop_event) {
GST_DEBUG_OBJECT (uridecodebin, GST_DEBUG_OBJECT (uridecodebin,
"Dropping EOS event because in gapless mode"); "Dropping EOS event because in gapless mode");
return GST_PAD_PROBE_DROP; return GST_PAD_PROBE_DROP;