Hello,
I'm developing an iOS gstreamer application which essentially receives and visualizes an UDP multicast h264 stream. Everything works as expected, until Mobile network > Mobile data is turned on in the settings app on an iOS device with a SIM card. As soon as WWAN traffic is possible, no UDP packages are received by the gstreamer pipeline any longer (and as such no video displayed). I have a separate application (no gstreamer involved), which creates an UDP socket listening on the same multicast address and port as the pipeline. In this application, turning the mobile data on or off has no influence on receiving UDP packages over WIFI. As such, I know this is not a limitation of the hardware or operating system. This has been confirmed to me by an Apple engineer. Furthermore, the Bonjour protocol is using UDP multicast as well independent of the mobile data status. This is the pipeline I'm using: udpsrc multicast-iface=en0 address=224.1.1.1 port=5004 ! application/x-rtp, media=(string)video, clock-rate=(int)90000, .... ! rtpjitterbuffer latency=400 ! rtph264depay ! h264parse ! vtdec ! videoconvert ! autovideosink and I'm currently on gstreamer 1.10.2, iOS 9 and 10. I have looked at the code in gstreamer (gstudpsrc.c > gst_udpsrc_open) and glib (gsocket.c > g_socket_multicast_group_operation) where the socket related operations are preformed, but don't see anything obviously odd at first sight. 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. Thanks a lot. -- Kind Regards, Dries Langsweirdt _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
On Wed, 2016-12-07 at 01:17 +0100, Dries Langsweirdt wrote:
> > 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. 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? -- Sebastian Dröge, Centricular Ltd · http://www.centricular.com _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel signature.asc (981 bytes) Download Attachment |
Hello,
I got this problem solved. I'm leaving this here for future visitors. Socket code that is working correctly (receiving multicast UDP when mobile data is turned on) is as follows: ---------- fd = socket(AF_INET, SOCK_DGRAM, 0); memset(&addr, 0, sizeof(addr)); addr.sin_len = sizeof(addr); addr.sin_family = AF_INET; addr.sin_addr.s_addr = INADDR_ANY; addr.sin_port = ntohs(5004); bind(fd, (const struct sockaddr *) &addr, sizeof(addr)) == 0; mreq.gr_interface = if_nametoindex(@"en0"); memset(&mreq.gr_group, 0, sizeof(mreq.gr_group)); a = (struct sockaddr_in *) &mreq.gr_group; a->sin_len = sizeof(addr); a->sin_family = AF_INET; a->sin_addr.s_addr = inet_addr("224.1.1.1"); a->sin_port = 0; setsockopt(fd, IPPROTO_IP, MCAST_JOIN_GROUP, &mreq, sizeof(mreq)) == 0; ---------- When I compare this with the socket creation code in Glib, I see a few differences: - https://github.com/GNOME/glib/blob/master/gio/gsocket.c#L2280 => GlIb is using the group join operation IP_ADD_SOURCE_MEMBERSHIP, while the above code uses MCAST_JOIN_GROUP. - https://github.com/GNOME/glib/blob/master/gio/gsocket.c#L2236 => 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); 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): ---------- gsocket_video = g_socket_new_from_fd(fd, &error); ... pipeline = gst_parse_launch(pipeline_desc, &error); ... GstElement* srcvideo = gst_bin_get_by_name((GstBin*)pipeline, "srcvideo"); g_object_set (srcvideo, "socket", gsocket_video, NULL); ---------- To answer this question: "Also is switching WWAN on causing a new interface to appear, or what effects does it have?" => 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. On 07/12/16 11:25, Sebastian Dröge wrote: On Wed, 2016-12-07 at 01:17 +0100, Dries Langsweirdt wrote: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.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? --
Met vriendelijke groeten,
Dries Langsweirdt
Flow Pilots Please be informed that the Flow Pilots offices will be closed from Dec 26th 2016 until Jan 1st. 2017. _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
On Thu, 2016-12-08 at 12:54 +0100, Dries Langsweirdt wrote:
> > When I compare this with the socket creation code in Glib, I see a > few differences: > > - https://github.com/GNOME/glib/blob/master/gio/gsocket.c#L2280 => > GlIb is using the group join operation IP_ADD_SOURCE_MEMBERSHIP, > while the above code uses MCAST_JOIN_GROUP. > - https://github.com/GNOME/glib/blob/master/gio/gsocket.c#L2236 => > 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); IP_ADD_SOURCE_MEMBERSHIP and MCAST_JOIN_GROUP should have the same effect. But we should probably change GLib to switch to the other one in that case. You said, you talked to an Apple engineer. Maybe ask him about the differences between the two sockopts and if they can fix their code so they behave the same in the future. Please also file a bug about this against GLib: https://bugzilla.gnome.org/enter_bug.cgi?product=glib -- Sebastian Dröge, Centricular Ltd · http://www.centricular.com _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel signature.asc (981 bytes) Download Attachment |
On Fri, 2016-12-09 at 07:52 +0200, Sebastian Dröge wrote:
> On Thu, 2016-12-08 at 12:54 +0100, Dries Langsweirdt wrote: > > > > When I compare this with the socket creation code in Glib, I see a > > few differences: > > > > > > - https://github.com/GNOME/glib/blob/master/gio/gsocket.c#L2280 => > > GlIb is using the group join operation IP_ADD_SOURCE_MEMBERSHIP, > > while the above code uses MCAST_JOIN_GROUP. > > > > - https://github.com/GNOME/glib/blob/master/gio/gsocket.c#L2236 => > > 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); > > That would seem like a bug in iOS's network stack then. > IP_ADD_SOURCE_MEMBERSHIP and MCAST_JOIN_GROUP should have the same > effect. But we should probably change GLib to switch to the other one > in that case. > > You said, you talked to an Apple engineer. Maybe ask him about the > differences between the two sockopts and if they can fix their code so > they behave the same in the future. > > > Please also file a bug about this against GLib: > https://bugzilla.gnome.org/enter_bug.cgi?product=glib https://bugzilla.gnome.org/show_bug.cgi?id=775873 -- Sebastian Dröge, Centricular Ltd · http://www.centricular.com _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel signature.asc (981 bytes) Download Attachment |
Free forum by Nabble | Edit this page |