Commit graph

11 commits

Author SHA1 Message Date
Edward Hervey 80dfb7bb3f gst: Use memcpy() instead of strncpy() where appropriate
strncpy() is assumed to be for strings so the compiler assumes that
it will need an extra byte for the string-terminaning NULL.

For cases where we know it's actually "binary" data, just copy it
with memcpy.

https://bugzilla.gnome.org/show_bug.cgi?id=795756
2018-05-07 17:05:36 +02:00
Sebastian Dröge 533d1c8eb7 ptp-helper: Disable multicast loopback
We're not really interested in our own packets and ignore them anyway.
2015-11-18 09:21:23 +02:00
Sebastian Dröge 29d11c4566 gst-ptp-helper: #include <sys/socket.h> to fix net/if.h include on OSX 10.6
In file included from gst-ptp-helper.c:40:0:
   /usr/include/net/if.h:265:19: error: field 'ifru_addr' has incomplete type
      struct sockaddr ifru_addr;

https://bugzilla.gnome.org/show_bug.cgi?id=756136
2015-10-07 11:30:14 +01:00
Vineeth TM 215cfcf993 gstreamer: Fix memory leaks when context parse fails
When g_option_context_parse fails, context and error variables are not getting free'd
which results in memory leaks. Free'ing the same.

And replacing g_error_free with g_clear_error, which checks if the error being passed
is not NULL and sets the variable to NULL on free'ing.

https://bugzilla.gnome.org/show_bug.cgi?id=753851
2015-10-02 17:31:11 +03:00
Sebastian Dröge 1ae38f7ba7 ptp: Check for the actual API we use instead of just looking for __APPLE__
Should fix the build on FreeBSD, DragonFly and other BSDs.

https://bugzilla.gnome.org/show_bug.cgi?id=750530
2015-06-09 11:01:29 +02:00
Sebastian Dröge c8d777feaa ptp: Ensure that not too much is read from or written to struct ifreq.ifr_name 2015-06-08 12:03:30 +02:00
Sebastian Dröge f02de0e9a1 ptp-helper: Make sure to use g_poll() for the main context
The modified main context from https://bugzilla.gnome.org/show_bug.cgi?id=741054
somehow calls setugid(), which abort()s setuid root applications on OSX.
2015-06-04 19:05:44 +02:00
Sebastian Dröge c7c1dcd346 ptp-helper: Make sure that we are running setuid root if configured that way 2015-06-04 18:32:14 +02:00
Sebastian Dröge d33784ccd0 ptp-helper: Fix interface listing and MAC retrieval on OSX 2015-06-04 18:00:50 +02:00
Sebastian Dröge 3af74817c1 ptp: Don't use SIOCGIFHWADDR on Apple
Just #ifdef the code for now, this should be implemented around
IOKit later instead of using ioctls.
2015-06-03 17:08:40 +02:00
Sebastian Dröge 8d77759834 ptp: Initial implementation of a PTP clock
GstPtpClock implements a PTP (IEEE1588:2008) ordinary clock in
slave-only mode, that allows a GStreamer pipeline to synchronize
to a PTP network clock in some specific domain.

The PTP subsystem can be initialized with gst_ptp_init(), which then
starts a helper process to do the actual communication via the PTP
ports. This is required as PTP listens on ports < 1024 and thus
requires special privileges. Once this helper process is started, the
main process will synchronize to all PTP domains that are detected on
the selected interfaces.

gst_ptp_clock_new() then allows to create a GstClock that provides the
PTP time from a master clock inside a specific PTP domain. This clock
will only return valid timestamps once the timestamps in the PTP domain
are known. To check this, the GstPtpClock::internal-clock property and
the related notify::clock signal can be used. Once the internal clock
is not NULL, the PTP domain's time is known. Alternatively you can wait
for this with gst_ptp_clock_wait_ready().

To gather statistics about the PTP clock synchronization,
gst_ptp_statistics_callback_add() can be used. This gives the
application the possibility to collect all kinds of statistics
from the clock synchronization.

https://bugzilla.gnome.org/show_bug.cgi?id=749391
2015-06-03 13:55:28 +02:00