mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-18 07:47:17 +00:00
appsink: fix end condition of query drain handler
The while loop should end when all buffers "and" the preroll buffer are consumed but this means to continue waiting if there are still some pending buffers "or" preroll buffer. The unit test was correct but racy because of this mistake. I.e. because of the wrong "and" the while could finish too early. cd tests/check && GST_CHECKS=test_query_drain make elements/appsink.forever https://bugzilla.gnome.org/show_bug.cgi?id=789763
This commit is contained in:
parent
3300584e96
commit
8af7b1f70b
1 changed files with 1 additions and 1 deletions
|
@ -974,7 +974,7 @@ gst_app_sink_query (GstBaseSink * bsink, GstQuery * query)
|
||||||
{
|
{
|
||||||
g_mutex_lock (&priv->mutex);
|
g_mutex_lock (&priv->mutex);
|
||||||
GST_DEBUG_OBJECT (appsink, "waiting buffers to be consumed");
|
GST_DEBUG_OBJECT (appsink, "waiting buffers to be consumed");
|
||||||
while (priv->num_buffers > 0 && priv->preroll_buffer)
|
while (priv->num_buffers > 0 || priv->preroll_buffer)
|
||||||
g_cond_wait (&priv->cond, &priv->mutex);
|
g_cond_wait (&priv->cond, &priv->mutex);
|
||||||
g_mutex_unlock (&priv->mutex);
|
g_mutex_unlock (&priv->mutex);
|
||||||
ret = GST_BASE_SINK_CLASS (parent_class)->query (bsink, query);
|
ret = GST_BASE_SINK_CLASS (parent_class)->query (bsink, query);
|
||||||
|
|
Loading…
Reference in a new issue