rtspsrc: Don't error out on not-linked too early

Wait until all pads have been exposed before accepting a not-linked,
as pads are added one-by-one and downstream might not be interested
in the first ones to appear.

Follow up to
https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7946

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8798>
This commit is contained in:
Jan Schmidt 2025-04-09 18:08:19 +10:00 committed by GStreamer Marge Bot
parent bf24ca6d29
commit 7212848e41
2 changed files with 15 additions and 0 deletions

View File

@ -2845,6 +2845,7 @@ gst_rtspsrc_cleanup (GstRTSPSrc * src)
src->streams = NULL;
g_mutex_lock (&src->flow_combiner_lock);
gst_flow_combiner_reset (src->flow_combiner);
src->emitted_no_more_pads = FALSE;
g_mutex_unlock (&src->flow_combiner_lock);
if (src->manager) {
if (src->manager_sig_id) {
@ -3483,6 +3484,11 @@ gst_rtspsrc_handle_src_sink_chain (GstPad * pad, GstObject * parent,
ret =
gst_flow_combiner_update_pad_flow (stream->parent->flow_combiner,
stream->srcpad, ret);
if (ret == GST_FLOW_NOT_LINKED && !stream->parent->emitted_no_more_pads) {
// Ignore not-linked errors until we've added all pads,
// as downstream might only link one pad they are interested in.
ret = GST_FLOW_OK;
}
g_mutex_unlock (&stream->parent->flow_combiner_lock);
return ret;
@ -3502,6 +3508,11 @@ gst_rtspsrc_handle_src_sink_chain_list (GstPad * pad, GstObject * parent,
ret =
gst_flow_combiner_update_pad_flow (stream->parent->flow_combiner,
stream->srcpad, ret);
if (ret == GST_FLOW_NOT_LINKED && !stream->parent->emitted_no_more_pads) {
// Ignore not-linked errors until we've added all pads,
// as downstream might only link one pad they are interested in.
ret = GST_FLOW_OK;
}
g_mutex_unlock (&stream->parent->flow_combiner_lock);
return ret;
@ -3961,6 +3972,9 @@ new_manager_pad (GstElement * manager, GstPad * pad, GstRTSPSrc * src)
/* when we get here, all stream are added and we can fire the no-more-pads
* signal. */
gst_element_no_more_pads (GST_ELEMENT_CAST (src));
g_mutex_lock (&src->flow_combiner_lock);
src->emitted_no_more_pads = TRUE;
g_mutex_unlock (&src->flow_combiner_lock);
}
return;

View File

@ -230,6 +230,7 @@ struct _GstRTSPSrc {
GList *streams;
GMutex flow_combiner_lock;
GstFlowCombiner *flow_combiner;
gboolean emitted_no_more_pads;
GstStructure *props;
gboolean need_activate;