gst/udp/gstmultiudpsink.c: Fix multicast detection.

Original commit message from CVS:
* gst/udp/gstmultiudpsink.c: (gst_multiudpsink_add):
Fix multicast detection.
Don't try to join a multicast group if the address is not multicast.
* gst/udp/gstudpsrc.c: (gst_udpsrc_update_uri):
Small debug improvement.
This commit is contained in:
Wim Taymans 2007-04-29 12:19:21 +00:00
parent 6a790cb75a
commit 589b8282e8
3 changed files with 15 additions and 3 deletions

View file

@ -1,3 +1,12 @@
2007-04-29 Wim Taymans <wim@fluendo.com>
* gst/udp/gstmultiudpsink.c: (gst_multiudpsink_add):
Fix multicast detection.
Don't try to join a multicast group if the address is not multicast.
* gst/udp/gstudpsrc.c: (gst_udpsrc_update_uri):
Small debug improvement.
2007-04-27 Wim Taymans <wim@fluendo.com> 2007-04-27 Wim Taymans <wim@fluendo.com>
* gst/rtsp/gstrtspsrc.c: (gst_rtspsrc_stream_configure_transport), * gst/rtsp/gstrtspsrc.c: (gst_rtspsrc_stream_configure_transport),

View file

@ -478,18 +478,19 @@ gst_multiudpsink_add (GstMultiUDPSink * sink, const gchar * host, gint port)
/* if its an IP address */ /* if its an IP address */
if (inet_aton (host, &addr)) { if (inet_aton (host, &addr)) {
/* check if its a multicast address */ /* check if its a multicast address */
if ((ntohl (addr.s_addr) & 0xe0000000) == 0xe0000000) { if ((ntohl (addr.s_addr) & 0xf0000000) == 0xe0000000) {
GST_DEBUG_OBJECT (sink, "multicast address detected"); GST_DEBUG_OBJECT (sink, "multicast address detected");
client->multi_addr.imr_multiaddr.s_addr = addr.s_addr; client->multi_addr.imr_multiaddr.s_addr = addr.s_addr;
client->multi_addr.imr_interface.s_addr = INADDR_ANY; client->multi_addr.imr_interface.s_addr = INADDR_ANY;
client->theiraddr.sin_addr = client->multi_addr.imr_multiaddr; client->theiraddr.sin_addr = client->multi_addr.imr_multiaddr;
} else { } else {
GST_DEBUG_OBJECT (sink, "normal address detected");
client->theiraddr.sin_addr = *((struct in_addr *) &addr); client->theiraddr.sin_addr = *((struct in_addr *) &addr);
} }
/* if init_send has already been called, set sockopts for multicast */ /* if init_send has already been called, set sockopts for multicast */
if (*client->sock > 0) if (*client->sock > 0 && client->multi_addr.imr_multiaddr.s_addr)
join_multicast (client); join_multicast (client);
} }
/* we dont need to lookup for localhost */ /* we dont need to lookup for localhost */

View file

@ -550,6 +550,8 @@ gst_udpsrc_update_uri (GstUDPSrc * src)
{ {
g_free (src->uri); g_free (src->uri);
src->uri = g_strdup_printf ("udp://%s:%d", src->multi_group, src->port); src->uri = g_strdup_printf ("udp://%s:%d", src->multi_group, src->port);
GST_DEBUG_OBJECT (src, "updated uri to %s", src->uri);
} }
static gboolean static gboolean