diff --git a/libs/gst/check/gstharness.c b/libs/gst/check/gstharness.c index 38eb6e1365..1041f8abc5 100644 --- a/libs/gst/check/gstharness.c +++ b/libs/gst/check/gstharness.c @@ -182,6 +182,8 @@ struct _GstHarnessPrivate GstClockTime latency_min; GstClockTime latency_max; + gboolean is_live; + gboolean has_clock_wait; gboolean drop_buffers; GstClockTime last_push_ts; @@ -375,7 +377,8 @@ gst_harness_sink_query (GstPad * pad, GstObject * parent, GstQuery * query) switch (GST_QUERY_TYPE (query)) { case GST_QUERY_LATENCY: - gst_query_set_latency (query, TRUE, priv->latency_min, priv->latency_max); + gst_query_set_latency (query, priv->is_live, priv->latency_min, + priv->latency_max); break; case GST_QUERY_CAPS: { @@ -465,7 +468,8 @@ gst_harness_src_query (GstPad * pad, GstObject * parent, GstQuery * query) switch (GST_QUERY_TYPE (query)) { case GST_QUERY_LATENCY: - gst_query_set_latency (query, TRUE, priv->latency_min, priv->latency_max); + gst_query_set_latency (query, priv->is_live, priv->latency_min, + priv->latency_max); break; case GST_QUERY_CAPS: { @@ -683,6 +687,7 @@ gst_harness_new_empty (void) priv->last_push_ts = GST_CLOCK_TIME_NONE; priv->latency_min = 0; priv->latency_max = GST_CLOCK_TIME_NONE; + priv->is_live = TRUE; priv->drop_buffers = FALSE; priv->testclock = GST_TEST_CLOCK_CAST (gst_test_clock_new ()); @@ -2223,6 +2228,23 @@ gst_harness_set_upstream_latency (GstHarness * h, GstClockTime latency) priv->latency_min = latency; } +/** + * gst_harness_set_live: + * @h: a #GstHarness + * @is_live: %TRUE for live, %FALSE for non-live + * + * Sets the liveness reported by #GstHarness when receiving a latency-query. + * The default is %TRUE. + * + * Since: 1.20 + */ +void +gst_harness_set_live (GstHarness * h, gboolean is_live) +{ + GstHarnessPrivate *priv = h->priv; + priv->is_live = is_live; +} + /** * gst_harness_get_allocator: * @h: a #GstHarness diff --git a/libs/gst/check/gstharness.h b/libs/gst/check/gstharness.h index 3074f1f8be..e4290d94c4 100644 --- a/libs/gst/check/gstharness.h +++ b/libs/gst/check/gstharness.h @@ -260,6 +260,9 @@ GstClockTime gst_harness_query_latency (GstHarness * h); GST_CHECK_API void gst_harness_set_upstream_latency (GstHarness * h, GstClockTime latency); +GST_CHECK_API +void gst_harness_set_live (GstHarness * h, gboolean is_live); + /* allocation query parameters */ GST_CHECK_API