After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 776030 - udpsrc: Add to join multiple multicast interfaces
udpsrc: Add to join multiple multicast interfaces
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-good
git master
Other Linux
: Normal enhancement
: 1.11.1
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2016-12-13 02:36 UTC by Wonchul Lee
Modified: 2016-12-19 08:50 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
updsrc: Add to join multiple multicast interfaces (2.17 KB, patch)
2016-12-13 03:01 UTC, Wonchul Lee
needs-work Details | Review
updsrc: Add to join multiple multicast interfaces (4.13 KB, patch)
2016-12-17 07:46 UTC, Wonchul Lee
committed Details | Review

Description Wonchul Lee 2016-12-13 02:36:13 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.
Comment 1 Wonchul Lee 2016-12-13 03:01:18 UTC
Created attachment 341858 [details] [review]
updsrc: Add to join multiple multicast interfaces
Comment 2 Sebastian Dröge (slomo) 2016-12-13 09:21:56 UTC
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
Comment 3 Nicolas Dufresne (ndufresne) 2016-12-13 23:09:21 UTC
You can't do the same in multiudpsink. Choosing 1 interface is possible, but require root privileges.
Comment 4 Sebastian Dröge (slomo) 2016-12-14 07:13:15 UTC
(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.
Comment 5 Nicolas Dufresne (ndufresne) 2016-12-15 20:19:45 UTC
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.
Comment 6 Wonchul Lee 2016-12-17 07:46:07 UTC
Created attachment 342111 [details] [review]
updsrc: Add to join multiple multicast interfaces
Comment 7 Wonchul Lee 2016-12-17 07:52:56 UTC
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.
Comment 8 Sebastian Dröge (slomo) 2016-12-19 08:50:31 UTC
Attachment 342111 [details] pushed as c7e2347 - updsrc: Add to join multiple multicast interfaces