diff options
author | Wim Taymans <wim.taymans@collabora.co.uk> | 2012-02-27 09:02:07 +0100 |
---|---|---|
committer | Wim Taymans <wim.taymans@collabora.co.uk> | 2012-02-27 09:11:36 +0100 |
commit | eb84682e923431f41223bf754527ed27b0deccb9 (patch) | |
tree | 4d699e8a918b41429144e120bb23f34d041ede80 /libs | |
parent | 8909205b85b2dbae89cb21f7a24a10bf71ba3fe9 (diff) |
clock: make more stuff private
Expose methods to get and set the timeout because subclasses uses this.
Diffstat (limited to 'libs')
-rw-r--r-- | libs/gst/net/gstnetclientclock.c | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/libs/gst/net/gstnetclientclock.c b/libs/gst/net/gstnetclientclock.c index 59b24a978..691c414a8 100644 --- a/libs/gst/net/gstnetclientclock.c +++ b/libs/gst/net/gstnetclientclock.c @@ -128,17 +128,18 @@ static void gst_net_client_clock_init (GstNetClientClock * self) { GstClock *clock = GST_CLOCK_CAST (self); + GstNetClientClockPrivate *priv; - self->priv = GST_NET_CLIENT_CLOCK_GET_PRIVATE (self); + self->priv = priv = GST_NET_CLIENT_CLOCK_GET_PRIVATE (self); - self->priv->port = DEFAULT_PORT; - self->priv->address = g_strdup (DEFAULT_ADDRESS); + priv->port = DEFAULT_PORT; + priv->address = g_strdup (DEFAULT_ADDRESS); - clock->timeout = DEFAULT_TIMEOUT; + gst_clock_set_timeout (clock, DEFAULT_TIMEOUT); - self->priv->thread = NULL; + priv->thread = NULL; - self->priv->servaddr = NULL; + priv->servaddr = NULL; } static void @@ -224,19 +225,17 @@ gst_net_client_clock_observe_times (GstNetClientClock * self, clock = GST_CLOCK_CAST (self); - gst_clock_add_observation (GST_CLOCK (self), local_avg, remote, &r_squared); - - GST_CLOCK_SLAVE_LOCK (self); - if (clock->filling) { - current_timeout = 0; - } else { + if (gst_clock_add_observation (GST_CLOCK (self), local_avg, remote, + &r_squared)) { /* geto formula */ current_timeout = (1e-3 / (1 - MIN (r_squared, 0.99999))) * GST_SECOND; - current_timeout = MIN (current_timeout, clock->timeout); + current_timeout = MIN (current_timeout, gst_clock_get_timeout (clock)); + } else { + current_timeout = 0; } + GST_INFO ("next timeout: %" GST_TIME_FORMAT, GST_TIME_ARGS (current_timeout)); self->priv->timeout_expiration = gst_util_get_timestamp () + current_timeout; - GST_CLOCK_SLAVE_UNLOCK (clock); return; @@ -371,7 +370,7 @@ gst_net_client_clock_thread (gpointer data) /* reset timeout (but are expecting a response sooner anyway) */ self->priv->timeout_expiration = - gst_util_get_timestamp () + clock->timeout; + gst_util_get_timestamp () + gst_clock_get_timeout (clock); continue; } |