rtsp-server: add more support for multicast
authorWim Taymans <wim.taymans@collabora.co.uk>
Fri, 19 Mar 2010 17:03:40 +0000 (18:03 +0100)
committerWim Taymans <wim.taymans@collabora.co.uk>
Fri, 19 Mar 2010 17:03:40 +0000 (18:03 +0100)
gst/rtsp-server/rtsp-client.c
gst/rtsp-server/rtsp-media.c
gst/rtsp-server/rtsp-sdp.c

index 11a3317..a408bc4 100644 (file)
@@ -23,6 +23,9 @@
 #include "rtsp-sdp.h"
 #include "rtsp-params.h"
 
+/* temporary multicast address until it's configurable somewhere */
+#define MCAST_ADDRESS "224.2.0.1"
+
 static GMutex *tunnels_lock;
 static GHashTable *tunnels;
 
@@ -796,7 +799,7 @@ handle_setup_request (GstRTSPClient * client, GstRTSPUrl * uri,
   /* we have a valid transport now, set the destination of the client. */
   g_free (ct->destination);
   if (ct->lower_transport == GST_RTSP_LOWER_TRANS_UDP_MCAST) {
-    ct->destination = g_strdup ("224.2.0.1");
+    ct->destination = g_strdup (MCAST_ADDRESS);
   } else {
     url = gst_rtsp_connection_get_url (client->connection);
     ct->destination = g_strdup (url->host);
@@ -953,7 +956,10 @@ create_sdp (GstRTSPClient * client, GstRTSPMedia * media)
   gst_sdp_message_add_attribute (sdp, "control", "*");
 
   info.server_proto = proto;
-  info.server_ip = client->server_ip;
+  if (media->protocols & GST_RTSP_LOWER_TRANS_UDP_MCAST)
+    info.server_ip = MCAST_ADDRESS;
+  else
+    info.server_ip = client->server_ip;
 
   /* create an SDP for the media object */
   if (!gst_rtsp_sdp_from_media (sdp, &info, media))
index e4c11d7..89dc466 100644 (file)
@@ -27,6 +27,7 @@
 #define DEFAULT_SHARED         FALSE
 #define DEFAULT_REUSABLE       FALSE
 #define DEFAULT_PROTOCOLS      GST_RTSP_LOWER_TRANS_UDP | GST_RTSP_LOWER_TRANS_TCP
+//#define DEFAULT_PROTOCOLS      GST_RTSP_LOWER_TRANS_UDP_MCAST
 
 /* define to dump received RTCP packets */
 #undef DUMP_STATS
index 56ca719..82ed995 100644 (file)
@@ -85,7 +85,7 @@ gst_rtsp_sdp_from_media (GstSDPMessage *sdp, GstSDPInfo *info, GstRTSPMedia * me
     gst_sdp_media_set_proto (smedia, "RTP/AVP");
 
     /* for the c= line */
-    gst_sdp_media_add_connection (smedia, "IN", info->server_proto, info->server_ip, 0, 0);
+    gst_sdp_media_add_connection (smedia, "IN", info->server_proto, info->server_ip, 16, 0);
 
     /* get clock-rate, media type and params for the rtpmap attribute */
     gst_structure_get_int (s, "clock-rate", &caps_rate);