From 68ac6438f05feee6e3ccf493af484efcb030a79b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Olivier=20Cr=C3=AAte?= Date: Wed, 14 Jan 2015 14:38:09 -0500 Subject: [PATCH] aggregator: Protect exported pad members with the pad's object lock https://bugzilla.gnome.org/show_bug.cgi?id=742684 --- gst-libs/gst/base/gstaggregator.c | 9 ++++++++- gst-libs/gst/base/gstaggregator.h | 1 + 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/gst-libs/gst/base/gstaggregator.c b/gst-libs/gst/base/gstaggregator.c index 4f67b85dac..adc70dcb1f 100644 --- a/gst-libs/gst/base/gstaggregator.c +++ b/gst-libs/gst/base/gstaggregator.c @@ -191,8 +191,10 @@ gst_aggregator_pad_flush (GstAggregatorPad * aggpad, GstAggregator * agg) { GstAggregatorPadClass *klass = GST_AGGREGATOR_PAD_GET_CLASS (aggpad); + PAD_LOCK (aggpad); aggpad->eos = FALSE; aggpad->priv->flushing = FALSE; + PAD_UNLOCK (aggpad); if (klass->flush) return klass->flush (aggpad, agg); @@ -359,8 +361,13 @@ gst_aggregator_check_pads_ready (GstAggregator * self) for (l = sinkpads; l != NULL; l = l->next) { pad = l->data; - if (pad->buffer == NULL && !pad->eos) + PAD_LOCK (pad); + if (pad->buffer == NULL && !pad->eos) { + GST_OBJECT_UNLOCK (pad); goto pad_not_ready; + } + PAD_UNLOCK (pad); + } GST_OBJECT_UNLOCK (self); diff --git a/gst-libs/gst/base/gstaggregator.h b/gst-libs/gst/base/gstaggregator.h index 33c88cc065..a4ede1d89e 100644 --- a/gst-libs/gst/base/gstaggregator.h +++ b/gst-libs/gst/base/gstaggregator.h @@ -69,6 +69,7 @@ struct _GstAggregatorPad { GstPad parent; + /* Protected by the pad's object lock */ GstBuffer * buffer; GstSegment segment; gboolean eos;