clockselect: Add TAI clock support

Via new value for property clock-id, "tai", it's possible to use
GST_CLOCK_TYPE_TAI as pipeline clock.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1009>
This commit is contained in:
Ederson de Souza 2019-12-13 11:28:08 -08:00 committed by GStreamer Merge Bot
parent 443c01e119
commit 3ea0f694de
3 changed files with 34 additions and 0 deletions

View file

@ -56,6 +56,7 @@ gst_clock_select_clock_id_get_type (void)
"monotonic"},
{GST_CLOCK_SELECT_CLOCK_ID_REALTIME, "System realtime clock", "realtime"},
{GST_CLOCK_SELECT_CLOCK_ID_PTP, "PTP clock", "ptp"},
{GST_CLOCK_SELECT_CLOCK_ID_TAI, "System TAI clock", "tai"},
{0, NULL, NULL},
};
@ -195,6 +196,13 @@ gst_clock_select_provide_clock (GstElement * element)
"Failed to get PTP clock, falling back to pipeline default clock");
}
break;
case GST_CLOCK_SELECT_CLOCK_ID_TAI:
clock =
g_object_new (GST_TYPE_SYSTEM_CLOCK, "name", "DebugGstSystemClock",
NULL);
gst_object_ref_sink (clock);
gst_util_set_object_arg (G_OBJECT (clock), "clock-type", "tai");
break;
case GST_CLOCK_SELECT_CLOCK_ID_DEFAULT:
default:
clock = NULL;

View file

@ -39,6 +39,7 @@ enum _GstClockSelectClockId {
GST_CLOCK_SELECT_CLOCK_ID_MONOTONIC,
GST_CLOCK_SELECT_CLOCK_ID_REALTIME,
GST_CLOCK_SELECT_CLOCK_ID_PTP,
GST_CLOCK_SELECT_CLOCK_ID_TAI,
};
struct _GstClockSelect

View file

@ -22,6 +22,30 @@
#include <gst/check/gstcheck.h>
#include <gst/check/gstharness.h>
GST_START_TEST (test_clock_select_tai_clock)
{
GstHarness *h;
GstElement *element;
GstClock *clock;
guint clock_type;
h = gst_harness_new_parse ("clockselect clock-id=tai");
/* Check if element provides right clock */
element = gst_harness_find_element (h, "clockselect");
clock = gst_element_provide_clock (element);
fail_unless (GST_IS_SYSTEM_CLOCK (clock));
g_object_get (G_OBJECT (clock), "clock-type", &clock_type, NULL);
fail_unless_equals_uint64 (clock_type, GST_CLOCK_TYPE_TAI);
gst_object_unref (element);
gst_object_unref (clock);
gst_harness_teardown (h);
}
GST_END_TEST;
GST_START_TEST (test_clock_select_realtime_clock)
{
GstHarness *h;
@ -102,6 +126,7 @@ clock_select_suite (void)
tcase_add_test (tc_chain, test_clock_select_properties);
tcase_add_test (tc_chain, test_clock_select_monotonic_clock);
tcase_add_test (tc_chain, test_clock_select_realtime_clock);
tcase_add_test (tc_chain, test_clock_select_tai_clock);
return s;
}