From 5cdf66d5d2f6ad4bea9206b451674a2a64ed784f Mon Sep 17 00:00:00 2001 From: Petr Kulhavy Date: Tue, 30 Aug 2016 10:24:43 +0200 Subject: [PATCH] rtspsrc: allow missing control attribute in case of a single stream Improve RFC2326 - chapter C.3 compatibility: In case just a single stream is specified in SDP and the control attribute is missing do not drop the stream but rather assume "a=control:*" https://bugzilla.gnome.org/show_bug.cgi?id=770568 --- gst/rtsp/gstrtspsrc.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/gst/rtsp/gstrtspsrc.c b/gst/rtsp/gstrtspsrc.c index 7e942d0903..7e0d85a702 100644 --- a/gst/rtsp/gstrtspsrc.c +++ b/gst/rtsp/gstrtspsrc.c @@ -1612,7 +1612,8 @@ clear_ptmap_item (PtMapItem * item) } static GstRTSPStream * -gst_rtspsrc_create_stream (GstRTSPSrc * src, GstSDPMessage * sdp, gint idx) +gst_rtspsrc_create_stream (GstRTSPSrc * src, GstSDPMessage * sdp, gint idx, + gint n_streams) { GstRTSPStream *stream; const gchar *control_url; @@ -1667,6 +1668,11 @@ gst_rtspsrc_create_stream (GstRTSPSrc * src, GstSDPMessage * sdp, gint idx) GST_DEBUG_OBJECT (src, " container: %d", stream->container); GST_DEBUG_OBJECT (src, " control: %s", GST_STR_NULL (control_url)); + /* RFC 2326, C.3: missing control_url permitted in case of a single stream */ + if (control_url == NULL && n_streams == 1) { + control_url = ""; + } + if (control_url != NULL) { stream->control_url = g_strdup (control_url); /* Build a fully qualified url using the content_base if any or by prefixing @@ -6668,7 +6674,7 @@ gst_rtspsrc_open_from_sdp (GstRTSPSrc * src, GstSDPMessage * sdp, /* create streams */ n_streams = gst_sdp_message_medias_len (sdp); for (i = 0; i < n_streams; i++) { - gst_rtspsrc_create_stream (src, sdp, i); + gst_rtspsrc_create_stream (src, sdp, i, n_streams); } src->state = GST_RTSP_STATE_INIT;