From: Havard Graff Date: Fri, 26 Nov 2010 14:20:04 +0000 (+0100) Subject: rtpsession: make iterate_internal_links MT-safe X-Git-Tag: RELEASE-0.10.29~471 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f8370bb2a898eccb10e8771d9ab4c09be35d2db1;p=platform%2Fupstream%2Fgst-plugins-good.git rtpsession: make iterate_internal_links MT-safe --- diff --git a/gst/rtpmanager/gstrtpsession.c b/gst/rtpmanager/gstrtpsession.c index 64abc94..7301378 100644 --- a/gst/rtpmanager/gstrtpsession.c +++ b/gst/rtpmanager/gstrtpsession.c @@ -1463,24 +1463,27 @@ gst_rtp_session_event_recv_rtp_src (GstPad * pad, GstEvent * event) static GstIterator * gst_rtp_session_iterate_internal_links (GstPad * pad) { - GstRtpSession *rtpsession; + GstRtpSession *rtpsession = GST_RTP_SESSION (gst_pad_get_parent (pad)); GstPad *otherpad = NULL; - GstIterator *it; - - rtpsession = GST_RTP_SESSION (gst_pad_get_parent (pad)); + GstIterator *it = NULL; + GST_RTP_SESSION_LOCK (rtpsession); if (pad == rtpsession->recv_rtp_src) { - otherpad = rtpsession->recv_rtp_sink; + otherpad = gst_object_ref (rtpsession->recv_rtp_sink); } else if (pad == rtpsession->recv_rtp_sink) { - otherpad = rtpsession->recv_rtp_src; + otherpad = gst_object_ref (rtpsession->recv_rtp_src); } else if (pad == rtpsession->send_rtp_src) { - otherpad = rtpsession->send_rtp_sink; + otherpad = gst_object_ref (rtpsession->send_rtp_sink); } else if (pad == rtpsession->send_rtp_sink) { - otherpad = rtpsession->send_rtp_src; + otherpad = gst_object_ref (rtpsession->send_rtp_src); } + GST_RTP_SESSION_UNLOCK (rtpsession); - it = gst_iterator_new_single (GST_TYPE_PAD, otherpad, - (GstCopyFunction) gst_object_ref, (GFreeFunc) gst_object_unref); + if (otherpad) { + it = gst_iterator_new_single (GST_TYPE_PAD, otherpad, + (GstCopyFunction) gst_object_ref, (GFreeFunc) gst_object_unref); + gst_object_unref (otherpad); + } gst_object_unref (rtpsession);