mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-07 08:39:54 +00:00
appsink: Handle unlock in drain query handling too
And also handle flushing, we might otherwise wait here forever when flushing too.
This commit is contained in:
parent
9f9000e693
commit
dbd9ff1cf5
1 changed files with 16 additions and 0 deletions
|
@ -1026,9 +1026,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);
|
||||
|
|
Loading…
Reference in a new issue