GST system clock question

smaynard steve at secondstryke.com
Mon Apr 2 09:52:35 PDT 2012


I believe this is the answer to my question (please correct me if I am
wrong):

Switching the clock to REALTIME on Linux results in an accurate (as far as
your RTC is set) systicks since epoch.  Performing the same action on Win32
(XP or 7) results in essentially not change from MONOTONIC unless you set
the clock.  Therefore, when a REALTIME GST clock is desired on Win32 you
need to set the calibration with a calculated systicks (which you can obtain
by gettimeofday() and some math).

Below is a piece of my start-up code that handles this (and by the way
doesn't perturb Linux):

+    GstClockTime tmp, internal, external, rate_num, rate_denom;
+    GstClockType clockType;
+    struct timeval tv;
+
+    g_object_get(gstSystemClk, "clock-type", &clockType, NULL);
+    GST_INFO("GST clockType: %s", clockType == 0? "REALTIME" :
"MONOTONIC");
+    gst_clock_get_calibration(gstSystemClk,
+                              &internal, &external, &rate_num,
&rate_denom);
+    GST_INFO("GST int: %llu, ext: %llu, num: %llu, denom: %llu",
+                              internal, external, rate_num, rate_denom);
+    internal = gst_clock_get_time(gstSystemClk);
+    GST_INFO("GST clockTime: %llu", internal);
+    gettimeofday(&tv, NULL);
+    external = tv.tv_sec;
+    external *= 1000000000;
+    tmp = tv.tv_usec;
+    tmp *= 1000;
+    external += tmp;
+    GST_INFO("GST external: %llu", external);
+    gst_clock_set_calibration(gstSystemClk,
+                              internal, external, rate_num, rate_denom);
+    GST_INFO("GST clockTime: %llu", gst_clock_get_time(gstSystemClk));



--
View this message in context: http://gstreamer-devel.966125.n4.nabble.com/GST-system-clock-question-tp4520268p4526566.html
Sent from the GStreamer-devel mailing list archive at Nabble.com.


More information about the gstreamer-devel mailing list