mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-23 16:50:47 +00:00
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>
This commit is contained in:
parent
24f0370c2d
commit
d7272b3247
1 changed files with 7 additions and 3 deletions
|
@ -558,7 +558,6 @@ gst_concat_sink_event (GstPad * pad, GstObject * parent, GstEvent * event)
|
||||||
self->format = spad->segment.format;
|
self->format = spad->segment.format;
|
||||||
GST_DEBUG_OBJECT (self, "Operating in %s format",
|
GST_DEBUG_OBJECT (self, "Operating in %s format",
|
||||||
gst_format_get_name (self->format));
|
gst_format_get_name (self->format));
|
||||||
g_mutex_unlock (&self->lock);
|
|
||||||
} else if (self->format != spad->segment.format) {
|
} else if (self->format != spad->segment.format) {
|
||||||
g_mutex_unlock (&self->lock);
|
g_mutex_unlock (&self->lock);
|
||||||
GST_ELEMENT_ERROR (self, CORE, FAILED, (NULL),
|
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 (self->format),
|
||||||
gst_format_get_name (spad->segment.format)));
|
gst_format_get_name (spad->segment.format)));
|
||||||
ret = FALSE;
|
ret = FALSE;
|
||||||
} else {
|
break;
|
||||||
g_mutex_unlock (&self->lock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
g_mutex_unlock (&self->lock);
|
||||||
|
|
||||||
if (!gst_concat_pad_wait (spad, self)) {
|
if (!gst_concat_pad_wait (spad, self)) {
|
||||||
ret = FALSE;
|
ret = FALSE;
|
||||||
} else {
|
} else {
|
||||||
GstSegment segment = spad->segment;
|
GstSegment segment = spad->segment;
|
||||||
GstEvent *topush;
|
GstEvent *topush;
|
||||||
|
|
||||||
|
g_mutex_lock (&self->lock);
|
||||||
|
|
||||||
if (adjust_base) {
|
if (adjust_base) {
|
||||||
/* We know no duration */
|
/* We know no duration */
|
||||||
segment.duration = -1;
|
segment.duration = -1;
|
||||||
|
@ -609,6 +611,8 @@ gst_concat_sink_event (GstPad * pad, GstObject * parent, GstEvent * event)
|
||||||
topush = gst_event_new_segment (&segment);
|
topush = gst_event_new_segment (&segment);
|
||||||
gst_event_set_seqnum (topush, gst_event_get_seqnum (event));
|
gst_event_set_seqnum (topush, gst_event_get_seqnum (event));
|
||||||
|
|
||||||
|
g_mutex_unlock (&self->lock);
|
||||||
|
|
||||||
gst_pad_push_event (self->srcpad, topush);
|
gst_pad_push_event (self->srcpad, topush);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in a new issue