Commit graph

17 commits

Author SHA1 Message Date
Nirbheek Chauhan
806dbeeef3 Whenever we include windows.h, also define WIN32_LEAN_AND_MEAN
This reduces the number of symbols and code pulled in drastically
2016-02-20 10:07:42 +00:00
Nirbheek Chauhan
fd823ed129 ptpclock: Only include unistd.h if found
unistd.h is not provided by the  Microsoft Visual C++ compiler. It instead
provides the necessary defines through io.h
2016-02-20 10:07:31 +00:00
Sebastian Dröge
2bfa204c30 ptpclock: Add read-only properties to get the master and grandmaster clock ids 2015-12-29 16:29:13 +02:00
Vineeth TM
dc0ae9203a ptpclock: Fix error leak during failures
https://bugzilla.gnome.org/show_bug.cgi?id=755607
2015-09-25 10:14:45 +02:00
Olivier Crête
3ed95158cc ptp: Init function can take a NULL interfaces array 2015-06-29 20:27:19 -04:00
Sebastian Dröge
5ba9e9d9a8 ptp: Make sure to always initialize the variables we put into the statistics structure later
CID 1304676, 1304677, 1304678, 1304679.
2015-06-08 12:22:56 +02:00
Руслан Ижбулатов
499b8d841e ptp: Fix build on Windows, and in general the GI build when PTP support was not available
It's not going to work on Windows still, the helper process needs to be
ported.
2015-06-08 10:46:24 +02:00
Sebastian Dröge
64773fee9c ptpclock: Use the current path delay for calculation the local/remote clock times
The mean might currently be changing, and the current path delay is the
closest we can get to the actual delay around the current SYNC message.
2015-06-07 08:59:23 +02:00
Sebastian Dröge
179eebdf44 ptpclock: Use #define everywhere instead of G_N_ELEMENTS() 2015-06-06 14:34:39 +02:00
Sebastian Dröge
42b16c9e3c ptpclock: Use a system clock for the time observations instead of gst_util_get_timestamp()
They don't necessarily use the same underlying clocks (e.g. on Windows), or
might be configured to a different clock type (monotonic vs. real time clock).

We need the values a clean system clock returns, as those are the values used
by the internal clocks.
2015-06-06 14:19:21 +02:00
Sebastian Dröge
bf62a96549 ptpclock: Fix documentation a bit 2015-06-06 12:36:34 +02:00
Sebastian Dröge
d2da80e4e7 ptp: Fix debug output to print the difference instead of absolute values 2015-06-03 16:09:17 +02:00
Wim Taymans
e11568c5b8 ptpclock: fix compilation
Don't put code between declarations.
Fix use of uninitialized variables
2015-06-03 15:22:31 +02:00
Sebastian Dröge
ac2eb6e23e ptp: Add median based pre-filtering of delays
If the delay measurement is too far away from the median of the window of last
delay measurements, we discard it. This increases accuracy on wifi a lot.

https://bugzilla.gnome.org/show_bug.cgi?id=749391
2015-06-03 13:55:39 +02:00
Sebastian Dröge
02ba5b20c7 ptp: Add #define to only use SYNC messages for which we can send DELAY_REQ
https://bugzilla.gnome.org/show_bug.cgi?id=749391
2015-06-03 13:55:36 +02:00
Sebastian Dröge
5e1974fc08 ptp: Add #defines to enable/disable improvements for unreliable networks
We should do some more measurements with all these and check how much sense
they make for PTP. Also enabling them means not following IEEE1588-2008 by the
letter anymore.

https://bugzilla.gnome.org/show_bug.cgi?id=749391
2015-06-03 13:55:32 +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