From 8162b4ec8601506311202d2d955aa3d23fc7fe3d Mon Sep 17 00:00:00 2001 From: Thibault Saunier Date: Fri, 14 Feb 2025 13:04:27 -0300 Subject: [PATCH] audiorate: Take the tolerance into account when filling gaps The property is defined as: > The difference between incoming timestamp and next timestamp must exceed > the given value for audiorate to add or drop samples. so if the gap duration < tolerance, we should not act. Part-of: --- subprojects/gst-plugins-base/gst/audiorate/gstaudiorate.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/subprojects/gst-plugins-base/gst/audiorate/gstaudiorate.c b/subprojects/gst-plugins-base/gst/audiorate/gstaudiorate.c index 613e52809a..a5ffb6fd34 100644 --- a/subprojects/gst-plugins-base/gst/audiorate/gstaudiorate.c +++ b/subprojects/gst-plugins-base/gst/audiorate/gstaudiorate.c @@ -285,6 +285,12 @@ gst_audio_rate_fill_to_time (GstAudioRate * audiorate, GstClockTime time) !GST_CLOCK_TIME_IS_VALID (audiorate->next_ts)) return; + if (ABS (GST_CLOCK_DIFF (time, audiorate->next_ts)) <= audiorate->tolerance) { + GST_DEBUG_OBJECT (audiorate, + "Not filling gap as its duration < tolerance ( %" GST_TIMEP_FORMAT " )", + &audiorate->tolerance); + } + /* feed an empty buffer to chain with the given timestamp, * it will take care of filling */ buf = gst_buffer_new ();