gstrtpsession: Do not push events while holding SESSION_LOCK

Doing so can trigger deadlocks

Fixes: #4328
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8695>
This commit is contained in:
Ognyan Tonchev 2025-03-26 13:09:30 +01:00 committed by GStreamer Marge Bot
parent ebb1d1a4ae
commit 6db576f033

View File

@ -1577,6 +1577,9 @@ gst_rtp_session_send_rtcp (RTPSession * sess, RTPSource * src,
goto stopping; goto stopping;
if ((rtcp_src = rtpsession->send_rtcp_src)) { if ((rtcp_src = rtpsession->send_rtcp_src)) {
gboolean push_eos;
guint32 seqnum;
gst_object_ref (rtcp_src); gst_object_ref (rtcp_src);
GST_RTP_SESSION_UNLOCK (rtpsession); GST_RTP_SESSION_UNLOCK (rtpsession);
@ -1594,16 +1597,18 @@ gst_rtp_session_send_rtcp (RTPSession * sess, RTPSource * src,
* function/thread by using send_rtp_sink_eos directly instead of * function/thread by using send_rtp_sink_eos directly instead of
* GST_PAD_IS_EOS*/ * GST_PAD_IS_EOS*/
GST_RTP_SESSION_LOCK (rtpsession); GST_RTP_SESSION_LOCK (rtpsession);
if (all_sources_bye && rtpsession->priv->send_rtp_sink_eos) { push_eos = all_sources_bye && rtpsession->priv->send_rtp_sink_eos;
seqnum = rtpsession->priv->recv_rtcp_segment_seqnum;
GST_RTP_SESSION_UNLOCK (rtpsession);
if (push_eos) {
GstEvent *event; GstEvent *event;
GST_LOG_OBJECT (rtpsession, "sending EOS"); GST_LOG_OBJECT (rtpsession, "sending EOS");
event = gst_event_new_eos (); event = gst_event_new_eos ();
gst_event_set_seqnum (event, rtpsession->priv->recv_rtcp_segment_seqnum); gst_event_set_seqnum (event, seqnum);
gst_pad_push_event (rtcp_src, event); gst_pad_push_event (rtcp_src, event);
} }
GST_RTP_SESSION_UNLOCK (rtpsession);
gst_object_unref (rtcp_src); gst_object_unref (rtcp_src);
} else { } else {
GST_RTP_SESSION_UNLOCK (rtpsession); GST_RTP_SESSION_UNLOCK (rtpsession);