From 3e33a7a09fb46d582e22aaea0865901fa66f4b7c Mon Sep 17 00:00:00 2001 From: Mark Nauwelaerts Date: Mon, 1 Aug 2011 08:32:24 +0200 Subject: [PATCH] rtspsrc: configure rtcp interval if provided ... in PLAY response. --- gst/rtsp/gstrtspsrc.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/gst/rtsp/gstrtspsrc.c b/gst/rtsp/gstrtspsrc.c index 731e0266af..8ea7ebca9a 100644 --- a/gst/rtsp/gstrtspsrc.c +++ b/gst/rtsp/gstrtspsrc.c @@ -5955,6 +5955,34 @@ gst_rtspsrc_parse_rtpinfo (GstRTSPSrc * src, gchar * rtpinfo) return TRUE; } +static void +gst_rtspsrc_handle_rtcp_interval (GstRTSPSrc * src, gchar * rtcp) +{ + guint64 interval; + GList *walk; + + interval = strtoul (rtcp, NULL, 10); + GST_DEBUG_OBJECT (src, "rtcp interval: %" G_GUINT64_FORMAT " ms", interval); + + if (!interval) + return; + + interval *= GST_MSECOND; + + for (walk = src->streams; walk; walk = g_list_next (walk)) { + GstRTSPStream *stream = (GstRTSPStream *) walk->data; + + /* already (optionally) retrieved this when configuring manager */ + if (stream->session) { + GObject *rtpsession = stream->session; + + GST_DEBUG_OBJECT (src, "configure rtcp interval in session %p", + rtpsession); + g_object_set (rtpsession, "rtcp-min-interval", interval, NULL); + } + } +} + static gdouble gst_rtspsrc_get_float (const gchar * dstr) { @@ -6163,6 +6191,12 @@ gst_rtspsrc_play (GstRTSPSrc * src, GstSegment * segment, gboolean async) &hval, hval_idx++) == GST_RTSP_OK) gst_rtspsrc_parse_rtpinfo (src, hval); + /* some servers indicate RTCP parameters in PLAY response, + * rather than properly in SDP */ + if (gst_rtsp_message_get_header (&response, GST_RTSP_HDR_RTCP_INTERVAL, + &hval, 0) == GST_RTSP_OK) + gst_rtspsrc_handle_rtcp_interval (src, hval); + gst_rtsp_message_unset (&response); /* early exit when we did aggregate control */