Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/GStreamer/gstreamer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlivier CrĂȘte <olivier.crete@collabora.com>2021-03-17 02:02:06 +0300
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>2021-03-17 17:13:27 +0300
commitc6a98609e5a10db9c29ce5f0a994ebf58072898b (patch)
treec64a20219dfd52ff23b44274c94b33be30eaa202
parent12661d90a3a4202c579e184b95316fedd895fa71 (diff)
aggregator: Release the SRC lock while querying latency
This is required because the query could be intercepted and the application could send any other requests to the element from this thread. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/771>
-rw-r--r--libs/gst/base/gstaggregator.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/libs/gst/base/gstaggregator.c b/libs/gst/base/gstaggregator.c
index f9e71facb5..35e55f0b7a 100644
--- a/libs/gst/base/gstaggregator.c
+++ b/libs/gst/base/gstaggregator.c
@@ -2034,7 +2034,7 @@ gst_aggregator_request_new_pad (GstElement * element,
return GST_PAD (agg_pad);
}
-/* Must be called with SRC_LOCK held */
+/* Must be called with SRC_LOCK held, temporarily releases it! */
static gboolean
gst_aggregator_query_latency_unlocked (GstAggregator * self, GstQuery * query)
@@ -2042,7 +2042,10 @@ gst_aggregator_query_latency_unlocked (GstAggregator * self, GstQuery * query)
gboolean query_ret, live;
GstClockTime our_latency, min, max;
+ /* Temporarily release the lock to do the query. */
+ SRC_UNLOCK (self);
query_ret = gst_pad_query_default (self->srcpad, GST_OBJECT (self), query);
+ SRC_LOCK (self);
if (!query_ret) {
GST_WARNING_OBJECT (self, "Latency query failed");
@@ -2068,10 +2071,12 @@ gst_aggregator_query_latency_unlocked (GstAggregator * self, GstQuery * query)
}
if (min > max && GST_CLOCK_TIME_IS_VALID (max)) {
+ SRC_UNLOCK (self);
GST_ELEMENT_WARNING (self, CORE, CLOCK, (NULL),
("Impossible to configure latency: max %" GST_TIME_FORMAT " < min %"
GST_TIME_FORMAT ". Add queues or other buffering elements.",
GST_TIME_ARGS (max), GST_TIME_ARGS (min)));
+ SRC_LOCK (self);
return FALSE;
}
@@ -2102,7 +2107,8 @@ gst_aggregator_query_latency_unlocked (GstAggregator * self, GstQuery * query)
}
/*
- * MUST be called with the src_lock held.
+ * MUST be called with the src_lock held. Temporarily releases the lock inside
+ * gst_aggregator_query_latency_unlocked() to do the actual query!
*
* See gst_aggregator_get_latency() for doc
*/