From 09b97dd4ac0429412de941ce16466ab44606da33 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Fri, 19 Mar 2010 18:03:40 +0100 Subject: [PATCH] rtsp-server: add more support for multicast --- gst/rtsp-server/rtsp-client.c | 10 ++++++++-- gst/rtsp-server/rtsp-media.c | 1 + gst/rtsp-server/rtsp-sdp.c | 2 +- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/gst/rtsp-server/rtsp-client.c b/gst/rtsp-server/rtsp-client.c index 11a3317538..a408bc4c96 100644 --- a/gst/rtsp-server/rtsp-client.c +++ b/gst/rtsp-server/rtsp-client.c @@ -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)) diff --git a/gst/rtsp-server/rtsp-media.c b/gst/rtsp-server/rtsp-media.c index e4c11d7ab5..89dc466b54 100644 --- a/gst/rtsp-server/rtsp-media.c +++ b/gst/rtsp-server/rtsp-media.c @@ -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 diff --git a/gst/rtsp-server/rtsp-sdp.c b/gst/rtsp-server/rtsp-sdp.c index 56ca719b8e..82ed995082 100644 --- a/gst/rtsp-server/rtsp-sdp.c +++ b/gst/rtsp-server/rtsp-sdp.c @@ -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);