mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-06-05 06:58:56 +00:00
netclientclock: Don't reset calibration of internal clock whenever a new netclient clock is created
https://bugzilla.gnome.org/show_bug.cgi?id=763325
This commit is contained in:
parent
c1f2775dcb
commit
7124e56bb5
1 changed files with 19 additions and 14 deletions
|
@ -957,7 +957,7 @@ struct _GstNetClientClockPrivate
|
|||
GstClockTime roundtrip_limit;
|
||||
GstClockTime minimum_update_interval;
|
||||
|
||||
GstClockTime base_time;
|
||||
GstClockTime base_time, internal_base_time;
|
||||
|
||||
gchar *address;
|
||||
gint port;
|
||||
|
@ -1055,6 +1055,7 @@ static void
|
|||
gst_net_client_clock_init (GstNetClientClock * self)
|
||||
{
|
||||
GstNetClientClockPrivate *priv;
|
||||
GstClock *clock;
|
||||
|
||||
self->priv = priv = GST_NET_CLIENT_CLOCK_GET_PRIVATE (self);
|
||||
|
||||
|
@ -1066,7 +1067,11 @@ gst_net_client_clock_init (GstNetClientClock * 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 */
|
||||
|
@ -1210,9 +1215,15 @@ gst_net_client_clock_set_property (GObject * object, guint prop_id,
|
|||
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;
|
||||
|
@ -1335,18 +1346,6 @@ gst_net_client_clock_constructed (GObject * object)
|
|||
|
||||
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);
|
||||
|
||||
|
@ -1364,6 +1363,12 @@ gst_net_client_clock_get_internal_time (GstClock * 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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue