From f39812dc8fcf3d2696f26993efbddb3b60c18e7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Tue, 31 Dec 2024 10:50:58 +0200 Subject: [PATCH] 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: --- subprojects/gstreamer/gst/gstpad.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/subprojects/gstreamer/gst/gstpad.c b/subprojects/gstreamer/gst/gstpad.c index 1df2fdc623..c4dbce6db1 100644 --- a/subprojects/gstreamer/gst/gstpad.c +++ b/subprojects/gstreamer/gst/gstpad.c @@ -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