From b9ceafe5af016df012fab524418ae6b506a1f8a4 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Olivier=20Cr=C3=AAte?= Date: Fri, 13 Sep 2013 16:25:49 +0200 Subject: [PATCH] rtpsession: Demux RTCP buffers from the RTP stream If there are RTCP buffers in the RTP stream, process them as RTCP. This way, we want receive streams following RFC 5761 https://bugzilla.gnome.org/show_bug.cgi?id=687657 --- gst/rtpmanager/gstrtpsession.c | 6 ++++-- gst/rtpmanager/rtpsession.c | 16 ++++++---------- gst/rtpmanager/rtpsession.h | 3 ++- 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/gst/rtpmanager/gstrtpsession.c b/gst/rtpmanager/gstrtpsession.c index c9beff7..a445be9 100644 --- a/gst/rtpmanager/gstrtpsession.c +++ b/gst/rtpmanager/gstrtpsession.c @@ -1614,6 +1614,7 @@ gst_rtp_session_chain_recv_rtp (GstPad * pad, GstObject * parent, GstFlowReturn ret; GstClockTime current_time, running_time; GstClockTime timestamp; + guint64 ntpnstime; rtpsession = GST_RTP_SESSION (parent); priv = rtpsession->priv; @@ -1627,13 +1628,14 @@ gst_rtp_session_chain_recv_rtp (GstPad * pad, GstObject * parent, running_time = gst_segment_to_running_time (&rtpsession->recv_rtp_seg, GST_FORMAT_TIME, timestamp); + ntpnstime = GST_CLOCK_TIME_NONE; } else { - get_current_times (rtpsession, &running_time, NULL); + get_current_times (rtpsession, &running_time, &ntpnstime); } current_time = gst_clock_get_time (priv->sysclock); ret = rtp_session_process_rtp (priv->session, buffer, current_time, - running_time); + running_time, ntpnstime); if (ret != GST_FLOW_OK) goto push_error; diff --git a/gst/rtpmanager/rtpsession.c b/gst/rtpmanager/rtpsession.c index b68c8b1..d06ad26 100644 --- a/gst/rtpmanager/rtpsession.c +++ b/gst/rtpmanager/rtpsession.c @@ -1712,7 +1712,7 @@ source_update_sender (RTPSession * sess, RTPSource * source, */ GstFlowReturn rtp_session_process_rtp (RTPSession * sess, GstBuffer * buffer, - GstClockTime current_time, GstClockTime running_time) + GstClockTime current_time, GstClockTime running_time, guint64 ntpnstime) { GstFlowReturn result; guint32 ssrc; @@ -1729,8 +1729,11 @@ rtp_session_process_rtp (RTPSession * sess, GstBuffer * buffer, /* update pinfo stats */ if (!update_packet_info (sess, &pinfo, FALSE, TRUE, FALSE, buffer, - current_time, running_time, -1)) - goto invalid_packet; + current_time, running_time, ntpnstime)) { + GST_DEBUG ("invalid RTP packet received"); + RTP_SESSION_UNLOCK (sess); + return rtp_session_process_rtcp (sess, buffer, current_time, ntpnstime); + } ssrc = pinfo.ssrc; @@ -1791,13 +1794,6 @@ rtp_session_process_rtp (RTPSession * sess, GstBuffer * buffer, return result; /* ERRORS */ -invalid_packet: - { - gst_buffer_unref (buffer); - RTP_SESSION_UNLOCK (sess); - GST_DEBUG ("invalid RTP packet received"); - return GST_FLOW_OK; - } collision: { RTP_SESSION_UNLOCK (sess); diff --git a/gst/rtpmanager/rtpsession.h b/gst/rtpmanager/rtpsession.h index c8dee20..3ca6c16 100644 --- a/gst/rtpmanager/rtpsession.h +++ b/gst/rtpmanager/rtpsession.h @@ -333,7 +333,8 @@ RTPSource* rtp_session_create_source (RTPSession *sess); /* processing packets from receivers */ GstFlowReturn rtp_session_process_rtp (RTPSession *sess, GstBuffer *buffer, GstClockTime current_time, - GstClockTime running_time); + GstClockTime running_time, + guint64 ntpnstime); GstFlowReturn rtp_session_process_rtcp (RTPSession *sess, GstBuffer *buffer, GstClockTime current_time, guint64 ntpnstime); -- 2.7.4