From 9f9000e693694ea33c21607140ffc29aa1734062 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sebastian=20Dr=C3=B6ge?= Date: Wed, 2 May 2018 18:35:23 +0300 Subject: [PATCH] appsink: Make sure to also handle unlock when waiting for EOS to be handled Otherwise shutting down during EOS waiting will cause a deadlock. https://bugzilla.gnome.org/show_bug.cgi?id=795551 --- gst-libs/gst/app/gstappsink.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/gst-libs/gst/app/gstappsink.c b/gst-libs/gst/app/gstappsink.c index 4d8be0d..dba9043 100644 --- a/gst-libs/gst/app/gstappsink.c +++ b/gst-libs/gst/app/gstappsink.c @@ -731,6 +731,20 @@ gst_app_sink_event (GstBaseSink * sink, GstEvent * event) * consumed, which is a bit confusing for the application */ while (priv->num_buffers > 0 && !priv->flushing && priv->wait_on_eos) { + if (priv->unlock) { + /* we are asked to unlock, call the wait_preroll method */ + g_mutex_unlock (&priv->mutex); + if (gst_base_sink_wait_preroll (sink) != GST_FLOW_OK) { + /* Directly go out of here */ + gst_event_unref (event); + return FALSE; + } + + /* we are allowed to continue now */ + g_mutex_lock (&priv->mutex); + continue; + } + priv->wait_status |= STREAM_WAITING; g_cond_wait (&priv->cond, &priv->mutex); priv->wait_status &= ~STREAM_WAITING; -- 2.7.4