mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-06-18 05:50:41 +00:00
Merge branch 'gstharness-timeout-pulls' into 'main'
harness: make pulls' timeout customaizable See merge request gstreamer/gstreamer!851
This commit is contained in:
commit
2eb2149dd6
|
@ -211,6 +211,8 @@ struct _GstHarnessPrivate
|
||||||
gboolean eos_received;
|
gboolean eos_received;
|
||||||
|
|
||||||
GPtrArray *stress;
|
GPtrArray *stress;
|
||||||
|
|
||||||
|
guint64 pull_timeout;
|
||||||
};
|
};
|
||||||
|
|
||||||
static GstFlowReturn
|
static GstFlowReturn
|
||||||
|
@ -756,6 +758,9 @@ gst_harness_new_empty (void)
|
||||||
/* we have forwarding on as a default */
|
/* we have forwarding on as a default */
|
||||||
gst_harness_set_forwarding (h, TRUE);
|
gst_harness_set_forwarding (h, TRUE);
|
||||||
|
|
||||||
|
/* we default to 60s as pull timeout */
|
||||||
|
gst_harness_set_pull_timeout (h, G_USEC_PER_SEC * 60);
|
||||||
|
|
||||||
return h;
|
return h;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1636,6 +1641,31 @@ gst_harness_set_forward_pad (GstHarness * h, GstPad * fwdpad)
|
||||||
(GstObject *) fwdpad);
|
(GstObject *) fwdpad);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gst_harness_set_pull_timeout:
|
||||||
|
* @h: a #GstHarness
|
||||||
|
* @timeout: timeout in microseconds
|
||||||
|
*
|
||||||
|
* Sets the timeout to use on all pull-like methods. This affects src and sink
|
||||||
|
* harnesses if any.
|
||||||
|
*
|
||||||
|
* MT safe.
|
||||||
|
*
|
||||||
|
* Since: 1.20
|
||||||
|
**/
|
||||||
|
void
|
||||||
|
gst_harness_set_pull_timeout (GstHarness * h, guint64 timeout)
|
||||||
|
{
|
||||||
|
GstHarnessPrivate *priv = h->priv;
|
||||||
|
priv->pull_timeout = timeout;
|
||||||
|
|
||||||
|
/* propagate timeout to src and sink harnesses, if any */
|
||||||
|
if (h->src_harness)
|
||||||
|
gst_harness_set_pull_timeout (h->src_harness, timeout);
|
||||||
|
if (h->sink_harness)
|
||||||
|
gst_harness_set_pull_timeout (h->sink_harness, timeout);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gst_harness_create_buffer:
|
* gst_harness_create_buffer:
|
||||||
* @h: a #GstHarness
|
* @h: a #GstHarness
|
||||||
|
@ -1709,8 +1739,8 @@ gst_harness_push (GstHarness * h, GstBuffer * buffer)
|
||||||
* @h: a #GstHarness
|
* @h: a #GstHarness
|
||||||
*
|
*
|
||||||
* Pulls a #GstBuffer from the #GAsyncQueue on the #GstHarness sinkpad. The pull
|
* Pulls a #GstBuffer from the #GAsyncQueue on the #GstHarness sinkpad. The pull
|
||||||
* will timeout in 60 seconds. This is the standard way of getting a buffer
|
* will timeout in #GstHarness.pull_timeout seconds. This is the standard way
|
||||||
* from a harnessed #GstElement.
|
* of getting a buffer from a harnessed #GstElement.
|
||||||
*
|
*
|
||||||
* MT safe.
|
* MT safe.
|
||||||
*
|
*
|
||||||
|
@ -1723,7 +1753,7 @@ gst_harness_pull (GstHarness * h)
|
||||||
{
|
{
|
||||||
GstHarnessPrivate *priv = h->priv;
|
GstHarnessPrivate *priv = h->priv;
|
||||||
GstBuffer *buf = (GstBuffer *) g_async_queue_timeout_pop (priv->buffer_queue,
|
GstBuffer *buf = (GstBuffer *) g_async_queue_timeout_pop (priv->buffer_queue,
|
||||||
G_USEC_PER_SEC * 60);
|
priv->pull_timeout);
|
||||||
|
|
||||||
if (priv->blocking_push_mode) {
|
if (priv->blocking_push_mode) {
|
||||||
g_mutex_lock (&priv->blocking_push_mutex);
|
g_mutex_lock (&priv->blocking_push_mutex);
|
||||||
|
@ -2043,7 +2073,7 @@ gst_harness_push_event (GstHarness * h, GstEvent * event)
|
||||||
* @h: a #GstHarness
|
* @h: a #GstHarness
|
||||||
*
|
*
|
||||||
* Pulls an #GstEvent from the #GAsyncQueue on the #GstHarness sinkpad.
|
* Pulls an #GstEvent from the #GAsyncQueue on the #GstHarness sinkpad.
|
||||||
* Timeouts after 60 seconds similar to gst_harness_pull.
|
* Timeouts after #GstHarness.pull_timeout seconds similar to gst_harness_pull.
|
||||||
*
|
*
|
||||||
* MT safe.
|
* MT safe.
|
||||||
*
|
*
|
||||||
|
@ -2056,7 +2086,7 @@ gst_harness_pull_event (GstHarness * h)
|
||||||
{
|
{
|
||||||
GstHarnessPrivate *priv = h->priv;
|
GstHarnessPrivate *priv = h->priv;
|
||||||
return (GstEvent *) g_async_queue_timeout_pop (priv->sink_event_queue,
|
return (GstEvent *) g_async_queue_timeout_pop (priv->sink_event_queue,
|
||||||
G_USEC_PER_SEC * 60);
|
priv->pull_timeout);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2146,7 +2176,7 @@ gst_harness_push_upstream_event (GstHarness * h, GstEvent * event)
|
||||||
* @h: a #GstHarness
|
* @h: a #GstHarness
|
||||||
*
|
*
|
||||||
* Pulls an #GstEvent from the #GAsyncQueue on the #GstHarness srcpad.
|
* Pulls an #GstEvent from the #GAsyncQueue on the #GstHarness srcpad.
|
||||||
* Timeouts after 60 seconds similar to gst_harness_pull.
|
* Timeouts after #GstHarness.pull_timeout seconds similar to gst_harness_pull.
|
||||||
*
|
*
|
||||||
* MT safe.
|
* MT safe.
|
||||||
*
|
*
|
||||||
|
@ -2159,7 +2189,7 @@ gst_harness_pull_upstream_event (GstHarness * h)
|
||||||
{
|
{
|
||||||
GstHarnessPrivate *priv = h->priv;
|
GstHarnessPrivate *priv = h->priv;
|
||||||
return (GstEvent *) g_async_queue_timeout_pop (priv->src_event_queue,
|
return (GstEvent *) g_async_queue_timeout_pop (priv->src_event_queue,
|
||||||
G_USEC_PER_SEC * 60);
|
priv->pull_timeout);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -174,6 +174,9 @@ void gst_harness_set_blocking_push_mode (GstHarness * h);
|
||||||
GST_CHECK_API
|
GST_CHECK_API
|
||||||
void gst_harness_set_forwarding (GstHarness * h, gboolean forwarding);
|
void gst_harness_set_forwarding (GstHarness * h, gboolean forwarding);
|
||||||
|
|
||||||
|
GST_CHECK_API
|
||||||
|
void gst_harness_set_pull_timeout (GstHarness * h, guint64 timeout);
|
||||||
|
|
||||||
/* buffers */
|
/* buffers */
|
||||||
|
|
||||||
GST_CHECK_API
|
GST_CHECK_API
|
||||||
|
|
Loading…
Reference in a new issue