GNOME Bugzilla – Bug 776030
udpsrc: Add to join multiple multicast interfaces
Last modified: 2016-12-19 08:50:54 UTC
There was a requirement of accepting packets from multiple multicast interfaces, This should be done creating a socket and set multiple joining outsides of Udpsrc before this.
Created attachment 341858 [details] [review] updsrc: Add to join multiple multicast interfaces
Review of attachment 341858 [details] [review]: ::: gst/udp/gstudpsrc.c @@ +1438,3 @@ + n_ifaces = g_strv_length (ifaces); + + for (i = 0; i < n_ifaces; i++) { Instead of that, just > p = ifaces; > while (*p) { > ... > p++; > } No need to go over the array twice @@ +1440,3 @@ + for (i = 0; i < n_ifaces; i++) { + GST_DEBUG_OBJECT (src, "joining multicast group %s to interface %s", + src->address, ifaces[i]); You probably want to g_strstrip() the iface to allow "eth0, eth1" (note the space) @@ +1443,3 @@ + if (!g_socket_join_multicast_group (src->used_socket, + g_inet_socket_address_get_address (src->addr), + FALSE, ifaces[i], &err)) Same is also needed for leaving the multicast group again. And you probably want to add exactly the same code to multiudpsink too
You can't do the same in multiudpsink. Choosing 1 interface is possible, but require root privileges.
(In reply to Nicolas Dufresne (stormer) from comment #3) > You can't do the same in multiudpsink. Choosing 1 interface is possible, but > require root privileges. Why not? You just call g_socket_join/leave_multicast_group() with an interface like here.
Those functions are specific to the receiver. You'll notice Wim implemented SO_BINDTODEVICE on the sender for this same reason. But this requires privileges.
Created attachment 342111 [details] [review] updsrc: Add to join multiple multicast interfaces
patch updated, (forgot to check obsolete for old one..) It required privilege when tried to join multiple interfaces. It was possible to join multiple interface using for each socket with SO_BINDTODEVICE in multiudpsink.
Attachment 342111 [details] pushed as c7e2347 - updsrc: Add to join multiple multicast interfaces