From dc76ab2291e1984c2d8d809a82dd48b84950b312 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Tue, 15 Feb 2022 15:29:40 +0100 Subject: [PATCH] alsa: don't use dll when not rate matching Only use the DLL when we are driver or rate matching with another driver. --- spa/plugins/alsa/alsa-pcm.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/spa/plugins/alsa/alsa-pcm.c b/spa/plugins/alsa/alsa-pcm.c index eea9e96f7..a30be6cb3 100644 --- a/spa/plugins/alsa/alsa-pcm.c +++ b/spa/plugins/alsa/alsa-pcm.c @@ -1776,7 +1776,11 @@ static int update_time(struct state *state, uint64_t current_time, snd_pcm_sfram state->last_threshold = state->threshold; } err = SPA_CLAMP(err, -state->max_error, state->max_error); - corr = spa_dll_update(&state->dll, err); + + if (!follower || state->matching) + corr = spa_dll_update(&state->dll, err); + else + corr = 1.0; if (diff < 0) state->next_time += diff / corr * 1e9 / state->rate; @@ -1784,10 +1788,10 @@ static int update_time(struct state *state, uint64_t current_time, snd_pcm_sfram if (SPA_UNLIKELY((state->next_time - state->base_time) > BW_PERIOD)) { state->base_time = state->next_time; - spa_log_debug(state->log, "%p: follower:%d match:%d rate:%f " + spa_log_debug(state->log, "%s: follower:%d match:%d rate:%f " "bw:%f thr:%u del:%ld target:%ld err:%f", - state, follower, state->matching, corr, state->dll.bw, - state->threshold, delay, target, + state->props.device, follower, state->matching, + corr, state->dll.bw, state->threshold, delay, target, err); }