appsrc: Release lock before pushing segment event

Do not hold lock during event push. Similar fix to the commit
2e5908d33f but another place

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5925>
This commit is contained in:
Seungha Yang 2024-01-15 22:44:09 +09:00
parent ed4af574d8
commit 56f2c47400

View file

@ -1621,12 +1621,18 @@ gst_app_src_create (GstBaseSrc * bsrc, guint64 offset, guint size,
if (!gst_segment_is_equal (&priv->current_segment, segment)) { if (!gst_segment_is_equal (&priv->current_segment, segment)) {
GST_DEBUG_OBJECT (appsrc, GST_DEBUG_OBJECT (appsrc,
"Update new segment %" GST_PTR_FORMAT, event); "Update new segment %" GST_PTR_FORMAT, event);
/* Release lock temporarily during event push */
g_mutex_unlock (&priv->mutex);
if (!gst_base_src_push_segment (bsrc, segment)) { if (!gst_base_src_push_segment (bsrc, segment)) {
GST_ERROR_OBJECT (appsrc, GST_ERROR_OBJECT (appsrc,
"Couldn't set new segment %" GST_PTR_FORMAT, event); "Couldn't set new segment %" GST_PTR_FORMAT, event);
gst_event_unref (event); gst_event_unref (event);
g_mutex_lock (&priv->mutex);
goto invalid_segment; goto invalid_segment;
} }
g_mutex_lock (&priv->mutex);
gst_segment_copy_into (segment, &priv->current_segment); gst_segment_copy_into (segment, &priv->current_segment);
} }