From 589b8282e8dc812883f5183aa2125da77b00dfb4 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Sun, 29 Apr 2007 12:19:21 +0000 Subject: [PATCH] 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. --- ChangeLog | 9 +++++++++ gst/udp/gstmultiudpsink.c | 7 ++++--- gst/udp/gstudpsrc.c | 2 ++ 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7ad0526..219554e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2007-04-29 Wim Taymans + + * 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 * gst/rtsp/gstrtspsrc.c: (gst_rtspsrc_stream_configure_transport), diff --git a/gst/udp/gstmultiudpsink.c b/gst/udp/gstmultiudpsink.c index 542eb47..72fec4c 100644 --- a/gst/udp/gstmultiudpsink.c +++ b/gst/udp/gstmultiudpsink.c @@ -478,18 +478,19 @@ gst_multiudpsink_add (GstMultiUDPSink * sink, const gchar * host, gint port) /* if its an IP address */ if (inet_aton (host, &addr)) { /* check if its a multicast address */ - if ((ntohl (addr.s_addr) & 0xe0000000) == 0xe0000000) { - GST_DEBUG_OBJECT (sink, "multicast address detected"); + if ((ntohl (addr.s_addr) & 0xf0000000) == 0xe0000000) { + GST_DEBUG_OBJECT (sink, "multicast address detected"); client->multi_addr.imr_multiaddr.s_addr = addr.s_addr; client->multi_addr.imr_interface.s_addr = INADDR_ANY; client->theiraddr.sin_addr = client->multi_addr.imr_multiaddr; } else { + GST_DEBUG_OBJECT (sink, "normal address detected"); client->theiraddr.sin_addr = *((struct in_addr *) &addr); } /* 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); } /* we dont need to lookup for localhost */ diff --git a/gst/udp/gstudpsrc.c b/gst/udp/gstudpsrc.c index 6c6f701..073a2e1 100644 --- a/gst/udp/gstudpsrc.c +++ b/gst/udp/gstudpsrc.c @@ -550,6 +550,8 @@ gst_udpsrc_update_uri (GstUDPSrc * src) { g_free (src->uri); 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 -- 2.7.4