rtsp-server: add more support for multicast

This commit is contained in:
Wim Taymans 2010-03-19 18:03:40 +01:00
parent ac8343ea62
commit 09b97dd4ac
3 changed files with 10 additions and 3 deletions

View 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))

View 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

View 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);