aggregator: Always lock aggpad around update_time_level
authorJan Alexander Steffens (heftig) <jan.steffens@ltnglobal.com>
Wed, 2 Sep 2020 15:59:30 +0000 (17:59 +0200)
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Fri, 27 Jan 2023 02:40:04 +0000 (02:40 +0000)
`aggpad->segment` is protected by the `aggpad`'s object lock. We need to
take the lock before calling `update_time_level`.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3819>

subprojects/gstreamer/libs/gst/base/gstaggregator.c

index abd7110..5d1eb3d 100644 (file)
@@ -1636,7 +1636,7 @@ gst_aggregator_flush_start (GstAggregator * self, GstAggregatorPad * aggpad,
   PAD_FLUSH_UNLOCK (aggpad);
 }
 
-/* Must be called with the the PAD_LOCK held */
+/* Must be called with the PAD_LOCK and OBJECT_LOCK held */
 static void
 update_time_level (GstAggregatorPad * aggpad, gboolean head)
 {
@@ -3105,7 +3105,9 @@ apply_buffer (GstAggregatorPad * aggpad, GstBuffer * buffer, gboolean head)
   else
     aggpad->priv->tail_position = timestamp;
 
+  GST_OBJECT_LOCK (aggpad);
   update_time_level (aggpad, head);
+  GST_OBJECT_UNLOCK (aggpad);
 }
 
 /*