From b069db6a2e58e4db24855deb7c40525c7f63d63b Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Thu, 25 Jul 2013 17:35:02 +0200 Subject: [PATCH] session: parse packet outside of the session lock --- gst/rtpmanager/rtpsession.c | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/gst/rtpmanager/rtpsession.c b/gst/rtpmanager/rtpsession.c index 0d0c3bc247..bc0843b803 100644 --- a/gst/rtpmanager/rtpsession.c +++ b/gst/rtpmanager/rtpsession.c @@ -1654,21 +1654,8 @@ rtp_session_process_rtp (RTPSession * sess, GstBuffer * buffer, if (!gst_rtp_buffer_map (buffer, GST_MAP_READ, &rtp)) goto invalid_packet; - RTP_SESSION_LOCK (sess); - /* ignore more RTP packets when we left the session */ - if (sess->source->marked_bye) - goto ignore; - - /* update arrival stats */ - update_arrival_stats (sess, &arrival, TRUE, buffer, current_time, - running_time, -1); - - /* get SSRC and look up in session database */ + /* get SSRC to look up in session database */ ssrc = gst_rtp_buffer_get_ssrc (&rtp); - source = obtain_source (sess, ssrc, &created, &arrival, TRUE); - if (!source) - goto collision; - /* copy available csrc for later */ count = gst_rtp_buffer_get_csrc_count (&rtp); /* make sure to not overflow our array. An RTP buffer can maximally contain @@ -1680,6 +1667,19 @@ rtp_session_process_rtp (RTPSession * sess, GstBuffer * buffer, gst_rtp_buffer_unmap (&rtp); + RTP_SESSION_LOCK (sess); + /* ignore more RTP packets when we left the session */ + if (sess->source->marked_bye) + goto ignore; + + /* update arrival stats */ + update_arrival_stats (sess, &arrival, TRUE, buffer, current_time, + running_time, -1); + + source = obtain_source (sess, ssrc, &created, &arrival, TRUE); + if (!source) + goto collision; + prevsender = RTP_SOURCE_IS_SENDER (source); prevactive = RTP_SOURCE_IS_ACTIVE (source); oldrate = source->bitrate; @@ -1748,7 +1748,6 @@ invalid_packet: ignore: { RTP_SESSION_UNLOCK (sess); - gst_rtp_buffer_unmap (&rtp); gst_buffer_unref (buffer); GST_DEBUG ("ignoring RTP packet because we are leaving"); return GST_FLOW_OK; @@ -1756,7 +1755,6 @@ ignore: collision: { RTP_SESSION_UNLOCK (sess); - gst_rtp_buffer_unmap (&rtp); gst_buffer_unref (buffer); clean_arrival_stats (&arrival); GST_DEBUG ("ignoring packet because its collisioning");