mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-18 22:36:33 +00:00
GstSystemClock: Add GST_CLOCK_TYPE_TAI
GST_CLOCK_TYPE_TAI is GStreamer abstraction for CLOCK_TAI. Main motivation for this patch is support for transmission offloading features - when network packets are timestamped with the time they are deemed to be actually transmitted. Linux API for that requires that time to be in CLOCK_TAI coordinate. With GST_CLOCK_TYPE_TAI, applications can use CLOCK_TAI directly on their pipelines, avoiding the need to cross timestamp packet times. By leveraging system's CLOCK_TAI, applications also don't need to keep track of leap seconds - less burden for them. Just keep system's CLOCK_TAI accurate and use it.
This commit is contained in:
parent
47765e164b
commit
216d6dd0f0
3 changed files with 22 additions and 3 deletions
|
@ -560,7 +560,14 @@ clock_type_to_posix_id (GstClockType clock_type)
|
|||
return CLOCK_MONOTONIC;
|
||||
else
|
||||
#endif
|
||||
return CLOCK_REALTIME;
|
||||
if (clock_type == GST_CLOCK_TYPE_TAI)
|
||||
#ifdef HAVE_TAI_CLOCK
|
||||
return CLOCK_TAI;
|
||||
#else
|
||||
GST_ERROR
|
||||
("No CLOCK_TAI available on the system. Falling back to CLOCK_REALTIME");
|
||||
#endif
|
||||
return CLOCK_REALTIME;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -48,13 +48,16 @@ typedef struct _GstSystemClockPrivate GstSystemClockPrivate;
|
|||
* @GST_CLOCK_TYPE_MONOTONIC: monotonic time since some unspecified starting
|
||||
* point
|
||||
* @GST_CLOCK_TYPE_OTHER: some other time source is used (Since: 1.0.5)
|
||||
* @GST_CLOCK_TYPE_TAI: time since Epoch, but using International Atomic Time
|
||||
* as reference (Since 1.18)
|
||||
*
|
||||
* The different kind of clocks.
|
||||
*/
|
||||
typedef enum {
|
||||
GST_CLOCK_TYPE_REALTIME = 0,
|
||||
GST_CLOCK_TYPE_MONOTONIC = 1,
|
||||
GST_CLOCK_TYPE_OTHER = 2
|
||||
GST_CLOCK_TYPE_OTHER = 2,
|
||||
GST_CLOCK_TYPE_TAI = 3
|
||||
} GstClockType;
|
||||
|
||||
/**
|
||||
|
|
11
meson.build
11
meson.build
|
@ -256,7 +256,7 @@ if cc.links('''#include <pthread.h>
|
|||
cdata.set('HAVE_PTHREAD_SETNAME_NP_WITHOUT_TID', 1)
|
||||
endif
|
||||
|
||||
# Check for posix timers and the monotonic clock
|
||||
# Check for posix timers, monotonic clock and TAI clock
|
||||
time_prefix = '#include <time.h>\n'
|
||||
if cdata.has('HAVE_UNISTD_H')
|
||||
time_prefix += '#include <unistd.h>'
|
||||
|
@ -280,6 +280,15 @@ if cc.compiles(monotonic_clock_src, name : 'monotonic clock from time.h')
|
|||
cdata.set('HAVE_MONOTONIC_CLOCK', 1)
|
||||
endif
|
||||
|
||||
tai_clock_src = time_prefix + '''
|
||||
#if !defined(CLOCK_TAI)
|
||||
#error CLOCK_TAI not defined
|
||||
#endif
|
||||
'''
|
||||
if cc.compiles(tai_clock_src, name : 'TAI clock from time.h')
|
||||
cdata.set('HAVE_TAI_CLOCK', 1)
|
||||
endif
|
||||
|
||||
# Check for __uint128_t (gcc) by checking for 128-bit division
|
||||
uint128_t_src = '''int main() {
|
||||
static __uint128_t v1 = 100;
|
||||
|
|
Loading…
Reference in a new issue