From 631d356845e15e38142c9fe5a9158a46fdd5a3ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Mon, 22 Dec 2014 22:00:26 +0100 Subject: [PATCH] audiotestsrc: 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 audiotestsrc. https://bugzilla.gnome.org/show_bug.cgi?id=741879 --- gst/audiotestsrc/gstaudiotestsrc.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/gst/audiotestsrc/gstaudiotestsrc.c b/gst/audiotestsrc/gstaudiotestsrc.c index 9ed89daaa4..04d9de6941 100644 --- a/gst/audiotestsrc/gstaudiotestsrc.c +++ b/gst/audiotestsrc/gstaudiotestsrc.c @@ -341,6 +341,23 @@ gst_audio_test_src_query (GstBaseSrc * basesrc, GstQuery * query) res = TRUE; break; } + case GST_QUERY_LATENCY: + { + if (src->info.rate > 0) { + GstClockTime latency; + + latency = + gst_util_uint64_scale (src->generate_samples_per_buffer, GST_SECOND, + src->info.rate); + 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; + } default: res = GST_BASE_SRC_CLASS (parent_class)->query (basesrc, query); break;