diff options
author | Sebastian Dröge <sebastian@centricular.com> | 2018-05-02 18:39:31 +0300 |
---|---|---|
committer | Sebastian Dröge <sebastian@centricular.com> | 2018-05-14 16:56:11 +0300 |
commit | d5eebdd830e833bfd0950a65d22b788c4a7239c5 (patch) | |
tree | df7208e5975d3fc45ade03d07c19f9bfba006cbc | |
parent | 1fe0bf12a6a7ee85ad7576cf339a6f125c7b3051 (diff) | |
download | gstreamer-plugins-base-d5eebdd830e833bfd0950a65d22b788c4a7239c5.tar.gz |
appsink: Handle unlock in drain query handling too
And also handle flushing, we might otherwise wait here forever when
flushing too.
-rw-r--r-- | gst-libs/gst/app/gstappsink.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/gst-libs/gst/app/gstappsink.c b/gst-libs/gst/app/gstappsink.c index a51b1793b..b070d80cf 100644 --- a/gst-libs/gst/app/gstappsink.c +++ b/gst-libs/gst/app/gstappsink.c @@ -1009,9 +1009,25 @@ gst_app_sink_query (GstBaseSink * bsink, GstQuery * query) g_mutex_lock (&priv->mutex); GST_DEBUG_OBJECT (appsink, "waiting buffers to be consumed"); while (priv->num_buffers > 0 || priv->preroll_buffer) { + if (priv->unlock) { + /* we are asked to unlock, call the wait_preroll method */ + g_mutex_unlock (&priv->mutex); + if (gst_base_sink_wait_preroll (bsink) != GST_FLOW_OK) { + /* Directly go out of here */ + 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; + + if (priv->flushing) + break; } g_mutex_unlock (&priv->mutex); ret = GST_BASE_SINK_CLASS (parent_class)->query (bsink, query); |