appsrc: Release priv->lock before pushing segment

Don't hold the private appsrc lock while pushing out a segment
event, which may block indefinitely.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4951>
This commit is contained in:
Jan Schmidt 2023-07-01 00:41:13 +10:00 committed by GStreamer Marge Bot
parent 0461103965
commit 2e5908d33f

View file

@ -1585,6 +1585,7 @@ needs_segment (GstMiniObject * obj)
return TRUE;
}
/* Called holding the priv->lock, and releases it temporarily */
static void
ensure_segment (GstAppSrc * appsrc)
{
@ -1595,8 +1596,10 @@ ensure_segment (GstAppSrc * appsrc)
GST_EVENT_SEGMENT, 0);
if (!seg_event) {
g_mutex_unlock (&priv->mutex);
GST_DEBUG_OBJECT (appsrc, "sending default segment");
gst_base_src_push_segment (GST_BASE_SRC_CAST (appsrc), &priv->last_segment);
g_mutex_lock (&priv->mutex);
} else {
gst_event_unref (seg_event);
}