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
This commit is contained in:
Olivier Crête 2015-01-21 19:44:57 -05:00 committed by Tim-Philipp Müller
parent 1d5f3fe084
commit be58999bff

View file

@ -565,7 +565,6 @@ gst_aggregator_wait_and_check (GstAggregator * self, gboolean * timeout)
clock = GST_ELEMENT_CLOCK (self); clock = GST_ELEMENT_CLOCK (self);
if (clock) if (clock)
gst_object_ref (clock); gst_object_ref (clock);
GST_OBJECT_UNLOCK (self);
time = base_time + start; 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 (latency_min),
GST_TIME_ARGS (gst_clock_get_time (clock))); GST_TIME_ARGS (gst_clock_get_time (clock)));
GST_OBJECT_UNLOCK (self);
self->priv->aggregate_id = gst_clock_new_single_shot_id (clock, time); self->priv->aggregate_id = gst_clock_new_single_shot_id (clock, time);
gst_object_unref (clock); gst_object_unref (clock);
SRC_STREAM_UNLOCK (self); SRC_STREAM_UNLOCK (self);
@ -1175,6 +1176,7 @@ gst_aggregator_query_latency (GstAggregator * self, GstQuery * query)
gst_aggregator_query_sink_latency_foreach, &data); gst_aggregator_query_sink_latency_foreach, &data);
SRC_STREAM_UNLOCK (self); SRC_STREAM_UNLOCK (self);
GST_OBJECT_LOCK (self);
our_latency = self->priv->latency; our_latency = self->priv->latency;
if (data.live && GST_CLOCK_TIME_IS_VALID (our_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)) && GST_CLOCK_TIME_IS_VALID (data.max))
data.max += self->priv->sub_latency_max; data.max += self->priv->sub_latency_max;
GST_OBJECT_UNLOCK (self);
GST_DEBUG_OBJECT (self, "configured latency live:%s min:%" G_GINT64_FORMAT GST_DEBUG_OBJECT (self, "configured latency live:%s min:%" G_GINT64_FORMAT
" max:%" G_GINT64_FORMAT, data.live ? "true" : "false", data.min, " max:%" G_GINT64_FORMAT, data.live ? "true" : "false", data.min,
data.max); data.max);