mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-18 21:35:44 +00:00
gst/udp/gstudpsrc.c: If using multicast in udpsrc, bind to the multicast address rather than
Original commit message from CVS: Patch by: Rob Taylor <robtaylor at floopily dot org> * gst/udp/gstudpsrc.c: (gst_udpsrc_start): If using multicast in udpsrc, bind to the multicast address rather than IN_ADDR_ANY. This allows the simultanous use of multiple udpsrcs listening on different multicat addresses. Without this all udpsrcs will receive all packets from all subscribed multicast addresses. Fixes #383001.
This commit is contained in:
parent
93663539f7
commit
21c9ac41a9
2 changed files with 27 additions and 9 deletions
12
ChangeLog
12
ChangeLog
|
@ -1,3 +1,15 @@
|
|||
2006-12-06 Wim Taymans <wim@fluendo.com>
|
||||
|
||||
Patch by: Rob Taylor <robtaylor at floopily dot org>
|
||||
|
||||
* gst/udp/gstudpsrc.c: (gst_udpsrc_start):
|
||||
If using multicast in udpsrc, bind to the multicast address rather than
|
||||
IN_ADDR_ANY.
|
||||
This allows the simultanous use of multiple udpsrcs listening on
|
||||
different multicat addresses. Without this all udpsrcs will receive all
|
||||
packets from all subscribed multicast addresses.
|
||||
Fixes #383001.
|
||||
|
||||
2006-12-06 Jan Schmidt <thaytan@mad.scientist.com>
|
||||
|
||||
* ext/taglib/gstid3v2mux.cc:
|
||||
|
|
|
@ -652,8 +652,11 @@ gst_udpsrc_start (GstBaseSrc * bsrc)
|
|||
fcntl (WRITE_SOCKET (src), F_SETFL, O_NONBLOCK);
|
||||
#endif
|
||||
|
||||
if (!inet_aton (src->multi_group, &(src->multi_addr.imr_multiaddr)))
|
||||
src->multi_addr.imr_multiaddr.s_addr = 0;
|
||||
|
||||
if (src->sock == -1) {
|
||||
if ((ret = socket (AF_INET, SOCK_DGRAM, 0)) < 0)
|
||||
if ((ret = socket (PF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0)
|
||||
goto no_socket;
|
||||
|
||||
src->sock = ret;
|
||||
|
@ -667,7 +670,11 @@ gst_udpsrc_start (GstBaseSrc * bsrc)
|
|||
memset (&src->myaddr, 0, sizeof (src->myaddr));
|
||||
src->myaddr.sin_family = AF_INET; /* host byte order */
|
||||
src->myaddr.sin_port = htons (src->port); /* short, network byte order */
|
||||
src->myaddr.sin_addr.s_addr = INADDR_ANY;
|
||||
|
||||
if (src->multi_addr.imr_multiaddr.s_addr)
|
||||
src->myaddr.sin_addr.s_addr = src->multi_addr.imr_multiaddr.s_addr;
|
||||
else
|
||||
src->myaddr.sin_addr.s_addr = INADDR_ANY;
|
||||
|
||||
GST_DEBUG_OBJECT (src, "binding on port %d", src->port);
|
||||
if ((ret = bind (src->sock, (struct sockaddr *) &src->myaddr,
|
||||
|
@ -675,13 +682,12 @@ gst_udpsrc_start (GstBaseSrc * bsrc)
|
|||
goto bind_error;
|
||||
}
|
||||
|
||||
if (inet_aton (src->multi_group, &(src->multi_addr.imr_multiaddr))) {
|
||||
if (src->multi_addr.imr_multiaddr.s_addr) {
|
||||
src->multi_addr.imr_interface.s_addr = INADDR_ANY;
|
||||
if ((ret = setsockopt (src->sock, IPPROTO_IP, IP_ADD_MEMBERSHIP,
|
||||
&src->multi_addr, sizeof (src->multi_addr))) < 0)
|
||||
goto membership;
|
||||
}
|
||||
if (src->multi_addr.imr_multiaddr.s_addr) {
|
||||
src->multi_addr.imr_interface.s_addr = INADDR_ANY;
|
||||
if ((ret =
|
||||
setsockopt (src->sock, IPPROTO_IP, IP_ADD_MEMBERSHIP,
|
||||
&src->multi_addr, sizeof (src->multi_addr))) < 0)
|
||||
goto membership;
|
||||
}
|
||||
|
||||
len = sizeof (my_addr);
|
||||
|
|
Loading…
Reference in a new issue