From f6df7e9232b33dd8335cf5c13e7f0c951ee4dee3 Mon Sep 17 00:00:00 2001 From: Mike Brady Date: Wed, 27 Aug 2014 18:34:24 +0000 Subject: [PATCH] Add a simple pseudo-random throttle to keep the rate of corrections below 1:1000 on average -- that is, about 1 packet in three may be interpolated. --- player.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/player.c b/player.c index 37ea1be7..ef21cc0b 100644 --- a/player.c +++ b/player.c @@ -750,6 +750,13 @@ static void *player_thread_func(void *arg) { // debug(1,"DAC buffer too short to allow stuffing."); amount_to_stuff=0; } + + // try to keep the corrections definitely below 1 in 1000 audio frames + if (amount_to_stuff) { + uint32_t x = random()%1000; + if (x>352) + amount_to_stuff=0; + } if ((amount_to_stuff==0) && (fix_volume==0x10000)) { // if no stuffing needed and no volume adjustment, then