rtspsrc: allow missing control attribute in case of a single stream
authorPetr Kulhavy <brain@jikos.cz>
Tue, 30 Aug 2016 08:24:43 +0000 (10:24 +0200)
committerSebastian Dröge <sebastian@centricular.com>
Tue, 1 Nov 2016 18:13:49 +0000 (20:13 +0200)
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

index 7e942d0..7e0d85a 100644 (file)
@@ -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;