<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">Hello,<br>
<br>
I got this problem solved. I'm leaving this here for future
visitors.<br>
<br>
Socket code that is working correctly (receiving multicast UDP
when mobile data is turned on) is as follows:<br>
<br>
----------<br>
<br>
fd = socket(AF_INET, SOCK_DGRAM, 0);<br>
<br>
memset(&addr, 0, sizeof(addr));<br>
addr.sin_len = sizeof(addr);<br>
addr.sin_family = AF_INET;<br>
addr.sin_addr.s_addr = INADDR_ANY;<br>
addr.sin_port = ntohs(5004);<br>
<br>
bind(fd, (const struct sockaddr *) &addr, sizeof(addr)) == 0;<br>
<br>
mreq.gr_interface = if_nametoindex(@"en0");<br>
memset(&mreq.gr_group, 0, sizeof(mreq.gr_group));<br>
a = (struct sockaddr_in *) &mreq.gr_group;<br>
a->sin_len = sizeof(addr);<br>
a->sin_family = AF_INET;<br>
a->sin_addr.s_addr = inet_addr("224.1.1.1");<br>
a->sin_port = 0;<br>
<br>
setsockopt(fd, IPPROTO_IP, MCAST_JOIN_GROUP, &mreq,
sizeof(mreq)) == 0;<br>
<br>
----------<br>
<br>
When I compare this with the socket creation code in Glib, I see a
few differences:<br>
<br>
- <a class="moz-txt-link-freetext"
href="https://github.com/GNOME/glib/blob/master/gio/gsocket.c#L2280">https://github.com/GNOME/glib/blob/master/gio/gsocket.c#L2280</a>
=> GlIb is using the group join operation
IP_ADD_SOURCE_MEMBERSHIP, while the above code uses
MCAST_JOIN_GROUP.<br>
- <a class="moz-txt-link-freetext"
href="https://github.com/GNOME/glib/blob/master/gio/gsocket.c#L2236">https://github.com/GNOME/glib/blob/master/gio/gsocket.c#L2236</a>
=> GLib is only setting if_nametoindex (iface), but not
mc_req.imr_interface.s_addr = g_htonl (INADDR_ANY), while in the
above code: addr.sin_addr.s_addr = INADDR_ANY; and
mreq.gr_interface = if_nametoindex (iface);<br>
<br>
The way I have solved this is by constructing the socket myself,
similar to the example code provided, and to set the socket
manually on the udpsrc element(s):<br>
<br>
----------<br>
<br>
gsocket_video = g_socket_new_from_fd(fd, &error);<br>
...<br>
pipeline = gst_parse_launch(pipeline_desc, &error);<br>
...<br>
GstElement* srcvideo = gst_bin_get_by_name((GstBin*)pipeline,
"srcvideo");<br>
g_object_set (srcvideo, "socket", gsocket_video, NULL);<br>
<br>
----------<br>
<br>
To answer this question: "Also is switching WWAN on causing a new
interface to appear, or what effects does it have?"<br>
=> There are no new interfaces, the list of real and virtual
interfaces on iOS seem fixed. However, in my situation the WIFI is
a LAN (so there is no internet access). I assume that when mobile
data is turned on the default gateway of the system is changed in
order to prefer traffic over WWAN.<br>
<br>
<br>
<br>
On 07/12/16 11:25, Sebastian Dröge wrote:<br>
</div>
<blockquote cite="mid:1481106352.2416.153.camel@centricular.com"
type="cite">
<pre wrap="">On Wed, 2016-12-07 at 01:17 +0100, Dries Langsweirdt wrote:
</pre>
<blockquote type="cite">
<pre wrap="">
I would like to know if I'm looking at an application specific problem
or a general gstreamer problem, so if someone could confirm or
de-confirm this behavior that would be great. Any suggestions as to how
to proceed are greatly appreciated.
</pre>
</blockquote>
<pre wrap="">
This would seem like a GStreamer or GLib problem. Can you compare what
that other application does with the socket, and what udpsrc does
different?
Also is switching WWAN on causing a new interface to appear, or what
effects does it have?
</pre>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
gstreamer-devel mailing list
<a class="moz-txt-link-abbreviated" href="mailto:gstreamer-devel@lists.freedesktop.org">gstreamer-devel@lists.freedesktop.org</a>
<a class="moz-txt-link-freetext" href="https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel">https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel</a>
</pre>
</blockquote>
<br>
<br>
<div class="moz-signature">-- <br>
<p>Met vriendelijke groeten,</p>
<p>
Dries Langsweirdt<br>
Partner
</p>
<p>
Flow Pilots<br>
M +32497729982<br>
E <a class="moz-txt-link-abbreviated" href="mailto:dries.langsweirdt@flowpilots.com">dries.langsweirdt@flowpilots.com</a><br>
W <a class="moz-txt-link-abbreviated" href="http://www.flowpilots.com">www.flowpilots.com</a>
</p>
<p>
<i>Please be informed that the Flow Pilots offices will be
closed from Dec 26th 2016 until Jan 1st. 2017.</i>
</p>
</div>
</body>
</html>