pad: Reset not-linked last flow return on reconfigure events

The pad might actually be linked now and we'd only find out by actually pushing
a buffer downstream again.

The last flow return is used by GstFlowCombiner to detect if all pads are not
linked, and not resetting this when re-linking creates a race condition when
switching between pads where all pads are temporarily considered not linked.

Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/3836

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8224>
This commit is contained in:
Sebastian Dröge 2024-12-31 10:50:58 +02:00 committed by GStreamer Marge Bot
parent 68cdeeb882
commit f39812dc8f

View file

@ -5597,6 +5597,8 @@ gst_pad_push_event_unchecked (GstPad * pad, GstEvent * event,
case GST_EVENT_RECONFIGURE:
if (GST_PAD_IS_SINK (pad))
GST_OBJECT_FLAG_SET (pad, GST_PAD_FLAG_NEED_RECONFIGURE);
if (pad->ABI.abi.last_flowret == GST_FLOW_NOT_LINKED)
pad->ABI.abi.last_flowret = GST_FLOW_OK;
break;
default:
break;
@ -5948,9 +5950,6 @@ gst_pad_send_event_unchecked (GstPad * pad, GstEvent * event,
if (G_UNLIKELY (GST_PAD_IS_FLUSHING (pad)))
goto flushing;
break;
case GST_EVENT_RECONFIGURE:
if (GST_PAD_IS_SRC (pad))
GST_OBJECT_FLAG_SET (pad, GST_PAD_FLAG_NEED_RECONFIGURE);
default:
GST_CAT_DEBUG_OBJECT (GST_CAT_EVENT, pad,
"have event type %" GST_PTR_FORMAT, event);
@ -5978,6 +5977,12 @@ gst_pad_send_event_unchecked (GstPad * pad, GstEvent * event,
remove_event_by_type (pad, GST_EVENT_TAG);
GST_OBJECT_FLAG_UNSET (pad, GST_PAD_FLAG_EOS);
break;
case GST_EVENT_RECONFIGURE:
if (GST_PAD_IS_SRC (pad))
GST_OBJECT_FLAG_SET (pad, GST_PAD_FLAG_NEED_RECONFIGURE);
if (pad->ABI.abi.last_flowret == GST_FLOW_NOT_LINKED)
pad->ABI.abi.last_flowret = GST_FLOW_OK;
break;
default:
if (serialized) {
/* Take the stream lock to check the EOS status and drop the event