From be58999bffa5c7d16863bc3c3073141dfb2fd1b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Olivier=20Cr=C3=AAte?= Date: Wed, 21 Jan 2015 19:44:57 -0500 Subject: [PATCH] aggregator: Protect all latency related members with the object lock The locking was not consistent, now consistently use the object lock. https://bugzilla.gnome.org/show_bug.cgi?id=742684 --- libs/gst/base/gstaggregator.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libs/gst/base/gstaggregator.c b/libs/gst/base/gstaggregator.c index 73a655f2ac..ba4bc85366 100644 --- a/libs/gst/base/gstaggregator.c +++ b/libs/gst/base/gstaggregator.c @@ -565,7 +565,6 @@ gst_aggregator_wait_and_check (GstAggregator * self, gboolean * timeout) clock = GST_ELEMENT_CLOCK (self); if (clock) gst_object_ref (clock); - GST_OBJECT_UNLOCK (self); time = base_time + start; @@ -584,6 +583,8 @@ gst_aggregator_wait_and_check (GstAggregator * self, gboolean * timeout) GST_TIME_ARGS (latency_min), GST_TIME_ARGS (gst_clock_get_time (clock))); + GST_OBJECT_UNLOCK (self); + self->priv->aggregate_id = gst_clock_new_single_shot_id (clock, time); gst_object_unref (clock); SRC_STREAM_UNLOCK (self); @@ -1175,6 +1176,7 @@ gst_aggregator_query_latency (GstAggregator * self, GstQuery * query) gst_aggregator_query_sink_latency_foreach, &data); SRC_STREAM_UNLOCK (self); + GST_OBJECT_LOCK (self); our_latency = self->priv->latency; if (data.live && GST_CLOCK_TIME_IS_VALID (our_latency) && @@ -1218,6 +1220,8 @@ gst_aggregator_query_latency (GstAggregator * self, GstQuery * query) && GST_CLOCK_TIME_IS_VALID (data.max)) data.max += self->priv->sub_latency_max; + GST_OBJECT_UNLOCK (self); + GST_DEBUG_OBJECT (self, "configured latency live:%s min:%" G_GINT64_FORMAT " max:%" G_GINT64_FORMAT, data.live ? "true" : "false", data.min, data.max);