diff --git a/gst/rtpmanager/gstrtpsession.c b/gst/rtpmanager/gstrtpsession.c index 78007f5b8b..f09a3fb35e 100644 --- a/gst/rtpmanager/gstrtpsession.c +++ b/gst/rtpmanager/gstrtpsession.c @@ -1435,8 +1435,21 @@ gst_rtp_session_event_recv_rtp_src (GstPad * pad, GstObject * parent, break; } - if (forward) - ret = gst_pad_push_event (rtpsession->recv_rtp_sink, event); + if (forward) { + GstPad *recv_rtp_sink = NULL; + GST_RTP_SESSION_LOCK (rtpsession); + if (rtpsession->recv_rtp_sink) + recv_rtp_sink = gst_object_ref (rtpsession->recv_rtp_sink); + GST_RTP_SESSION_UNLOCK (rtpsession); + + if (recv_rtp_sink) { + ret = gst_pad_push_event (recv_rtp_sink, event); + gst_object_unref (recv_rtp_sink); + } else + gst_event_unref (event); + } else { + gst_event_unref (event); + } return ret; }