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:
authorMathieu Duponchelle <mathieu@centricular.com>2021-05-11 20:02:28 +0300
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>2021-05-11 22:13:08 +0300
commitd7272b324770a75a56ae71cdc407b09608a22d7e (patch)
treec9d8807c09aa1dbb890ef67fe57b5a7dd719b918
parent24f0370c2d9795d420ae0ba390686bf9fa3176a8 (diff)
concat: fix locking in SEGMENT event handler
concat->current_start_offset needs the lock taken for safe access, as it can be accessed from outside of the streaming thread, eg in release_pad. An early break is also added for an error case. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/818>
-rw-r--r--plugins/elements/gstconcat.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/plugins/elements/gstconcat.c b/plugins/elements/gstconcat.c
index 35f43c4b03..9b732fe567 100644
--- a/plugins/elements/gstconcat.c
+++ b/plugins/elements/gstconcat.c
@@ -558,7 +558,6 @@ gst_concat_sink_event (GstPad * pad, GstObject * parent, GstEvent * event)
self->format = spad->segment.format;
GST_DEBUG_OBJECT (self, "Operating in %s format",
gst_format_get_name (self->format));
- g_mutex_unlock (&self->lock);
} else if (self->format != spad->segment.format) {
g_mutex_unlock (&self->lock);
GST_ELEMENT_ERROR (self, CORE, FAILED, (NULL),
@@ -566,16 +565,19 @@ gst_concat_sink_event (GstPad * pad, GstObject * parent, GstEvent * event)
gst_format_get_name (self->format),
gst_format_get_name (spad->segment.format)));
ret = FALSE;
- } else {
- g_mutex_unlock (&self->lock);
+ break;
}
+ g_mutex_unlock (&self->lock);
+
if (!gst_concat_pad_wait (spad, self)) {
ret = FALSE;
} else {
GstSegment segment = spad->segment;
GstEvent *topush;
+ g_mutex_lock (&self->lock);
+
if (adjust_base) {
/* We know no duration */
segment.duration = -1;
@@ -609,6 +611,8 @@ gst_concat_sink_event (GstPad * pad, GstObject * parent, GstEvent * event)
topush = gst_event_new_segment (&segment);
gst_event_set_seqnum (topush, gst_event_get_seqnum (event));
+ g_mutex_unlock (&self->lock);
+
gst_pad_push_event (self->srcpad, topush);
}
break;