aggregator: Protect exported pad members with the pad's object lock
authorOlivier Crête <olivier.crete@collabora.com>
Wed, 14 Jan 2015 19:38:09 +0000 (14:38 -0500)
committerTim-Philipp Müller <tim@centricular.com>
Sat, 2 Dec 2017 15:10:26 +0000 (15:10 +0000)
https://bugzilla.gnome.org/show_bug.cgi?id=742684

libs/gst/base/gstaggregator.c
libs/gst/base/gstaggregator.h

index 4f67b85..adc70dc 100644 (file)
@@ -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);
index 33c88cc..a4ede1d 100644 (file)
@@ -69,6 +69,7 @@ struct _GstAggregatorPad
 {
   GstPad                       parent;
 
+  /* Protected by the pad's object lock */
   GstBuffer                 *  buffer;
   GstSegment                   segment;
   gboolean                     eos;