mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-25 01:30:38 +00:00
harness: fix the race in blocking push mode
Depending on when gst_harness_pull was called - before the buffer reached gst_harness_chain or after we can get different behaviors of the test with enabled blocking push mode. The fix makes the behavior always the same. In pull function we get the buffer first, thus making sure gst_harness_chain waits for the signal, and emitting the signal after. https://bugzilla.gnome.org/show_bug.cgi?id=761931
This commit is contained in:
parent
2450af1034
commit
06ae41e0b2
1 changed files with 5 additions and 3 deletions
|
@ -1538,6 +1538,8 @@ GstBuffer *
|
||||||
gst_harness_pull (GstHarness * h)
|
gst_harness_pull (GstHarness * h)
|
||||||
{
|
{
|
||||||
GstHarnessPrivate *priv = h->priv;
|
GstHarnessPrivate *priv = h->priv;
|
||||||
|
GstBuffer *buf = (GstBuffer *) g_async_queue_timeout_pop (priv->buffer_queue,
|
||||||
|
G_USEC_PER_SEC * 60);
|
||||||
|
|
||||||
if (priv->blocking_push_mode) {
|
if (priv->blocking_push_mode) {
|
||||||
g_mutex_lock (&priv->blocking_push_mutex);
|
g_mutex_lock (&priv->blocking_push_mutex);
|
||||||
|
@ -1545,8 +1547,7 @@ gst_harness_pull (GstHarness * h)
|
||||||
g_mutex_unlock (&priv->blocking_push_mutex);
|
g_mutex_unlock (&priv->blocking_push_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (GstBuffer *) g_async_queue_timeout_pop (priv->buffer_queue,
|
return buf;
|
||||||
G_USEC_PER_SEC * 60);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1567,6 +1568,7 @@ GstBuffer *
|
||||||
gst_harness_try_pull (GstHarness * h)
|
gst_harness_try_pull (GstHarness * h)
|
||||||
{
|
{
|
||||||
GstHarnessPrivate *priv = h->priv;
|
GstHarnessPrivate *priv = h->priv;
|
||||||
|
GstBuffer *buf = (GstBuffer *) g_async_queue_try_pop (priv->buffer_queue);
|
||||||
|
|
||||||
if (priv->blocking_push_mode) {
|
if (priv->blocking_push_mode) {
|
||||||
g_mutex_lock (&priv->blocking_push_mutex);
|
g_mutex_lock (&priv->blocking_push_mutex);
|
||||||
|
@ -1574,7 +1576,7 @@ gst_harness_try_pull (GstHarness * h)
|
||||||
g_mutex_unlock (&priv->blocking_push_mutex);
|
g_mutex_unlock (&priv->blocking_push_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (GstBuffer *) g_async_queue_try_pop (priv->buffer_queue);
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue