From 8abfdd127fd60a5720b579f3bf3a573966d25a88 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sebastian=20Dr=C3=B6ge?= Date: Mon, 22 Dec 2014 22:04:41 +0100 Subject: [PATCH] videotestsrc: Report our latency properly in live mode While we have no latency at all in theory, any other live source has the duration of one buffer as minimum latency. Do the same in videotestsrc. https://bugzilla.gnome.org/show_bug.cgi?id=741879 --- gst/videotestsrc/gstvideotestsrc.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/gst/videotestsrc/gstvideotestsrc.c b/gst/videotestsrc/gstvideotestsrc.c index b4787cf..a98611b 100644 --- a/gst/videotestsrc/gstvideotestsrc.c +++ b/gst/videotestsrc/gstvideotestsrc.c @@ -781,7 +781,7 @@ unsupported_caps: static gboolean gst_video_test_src_query (GstBaseSrc * bsrc, GstQuery * query) { - gboolean res; + gboolean res = FALSE; GstVideoTestSrc *src; src = GST_VIDEO_TEST_SRC (bsrc); @@ -799,6 +799,23 @@ gst_video_test_src_query (GstBaseSrc * bsrc, GstQuery * query) gst_query_set_convert (query, src_fmt, src_val, dest_fmt, dest_val); break; } + case GST_QUERY_LATENCY: + { + if (src->info.fps_n > 0) { + GstClockTime latency; + + latency = + gst_util_uint64_scale (GST_SECOND, src->info.fps_d, + src->info.fps_n); + gst_query_set_latency (query, + gst_base_src_is_live (GST_BASE_SRC_CAST (src)), latency, + GST_CLOCK_TIME_NONE); + GST_DEBUG_OBJECT (src, "Reporting latency of %" GST_TIME_FORMAT, + GST_TIME_ARGS (latency)); + res = TRUE; + } + break; + } case GST_QUERY_DURATION:{ if (bsrc->num_buffers != -1) { GstFormat format; -- 2.7.4