GstClockTime roundtrip_limit;
GstClockTime minimum_update_interval;
- GstClockTime base_time;
+ GstClockTime base_time, internal_base_time;
gchar *address;
gint port;
gst_net_client_clock_init (GstNetClientClock * self)
{
GstNetClientClockPrivate *priv;
+ GstClock *clock;
self->priv = priv = GST_NET_CLIENT_CLOCK_GET_PRIVATE (self);
priv->roundtrip_limit = DEFAULT_ROUNDTRIP_LIMIT;
priv->minimum_update_interval = DEFAULT_MINIMUM_UPDATE_INTERVAL;
+
+ clock = gst_system_clock_obtain ();
priv->base_time = DEFAULT_BASE_TIME;
+ priv->internal_base_time = gst_clock_get_time (clock);
+ gst_object_unref (clock);
}
/* Must be called with clocks_lock */
GST_OBJECT_UNLOCK (self);
update = TRUE;
break;
- case PROP_BASE_TIME:
+ case PROP_BASE_TIME:{
+ GstClock *clock;
+
self->priv->base_time = g_value_get_uint64 (value);
+ clock = gst_system_clock_obtain ();
+ self->priv->internal_base_time = gst_clock_get_time (clock);
+ gst_object_unref (clock);
break;
+ }
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
self->priv->internal_clock = internal_clock = cache->clock;
- /* gst_clock_get_time() values are guaranteed to be increasing. because no one
- * has called get_time on this clock yet we are free to adjust to any value
- * without worrying about worrying about MAX() issues with the clock's
- * internal time.
- */
-
- /* update our internal time so get_time() give something around base_time.
- assume that the rate is 1 in the beginning. */
- internal = gst_clock_get_internal_time (internal_clock);
- gst_clock_set_calibration (internal_clock, internal,
- self->priv->base_time, 1, 1);
-
{
GstClockTime now = gst_clock_get_time (internal_clock);
{
GstNetClientClock *self = GST_NET_CLIENT_CLOCK (clock);
+ if (!gst_clock_is_synced (self->priv->internal_clock)) {
+ GstClockTime now = gst_clock_get_internal_time (self->priv->internal_clock);
+ return gst_clock_adjust_with_calibration (self->priv->internal_clock, now,
+ self->priv->internal_base_time, self->priv->base_time, 1, 1);
+ }
+
return gst_clock_get_time (self->priv->internal_clock);
}