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.

This commit is contained in:
Mike Brady
2014-08-27 18:34:24 +00:00
parent a9a00dc8f0
commit f6df7e9232
+7
View File
@@ -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