From 197d2b15b60399416a372be5c57c15e6f4362364 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Tue, 24 Sep 2019 17:23:01 +0200 Subject: [PATCH] alsa-pcm: small cleanups --- spa/plugins/alsa/alsa-pcm.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/spa/plugins/alsa/alsa-pcm.c b/spa/plugins/alsa/alsa-pcm.c index 9c8ec760d..ff48ee186 100644 --- a/spa/plugins/alsa/alsa-pcm.c +++ b/spa/plugins/alsa/alsa-pcm.c @@ -642,7 +642,6 @@ static int update_time(struct state *state, uint64_t nsec, snd_pcm_sframes_t del state->next_time = nsec; state->base_time = nsec; } - state->z1 += state->w0 * (state->w1 * err - state->z1); state->z2 += state->w0 * (state->z1 - state->z2); state->z3 += state->w2 * state->z2; @@ -654,6 +653,7 @@ static int update_time(struct state *state, uint64_t nsec, snd_pcm_sframes_t del spa_log_trace(state->log, NAME" %p: slave:%d quantum change %d", state, slave, diff); state->next_time += diff / corr * 1e9 / state->rate; + state->last_threshold = state->threshold; } if ((state->next_time - state->base_time) > BW_PERIOD) { @@ -674,6 +674,9 @@ static int update_time(struct state *state, uint64_t nsec, snd_pcm_sframes_t del else state->rate_match->rate = SPA_CLAMP(1.0/corr, 0.95, 1.05); } + + state->next_time += state->threshold / corr * 1e9 / state->rate; + if (!slave && state->clock) { state->clock->nsec = nsec; state->clock->position += state->duration; @@ -688,9 +691,6 @@ static int update_time(struct state *state, uint64_t nsec, snd_pcm_sframes_t del state, slave, nsec, corr, delay, err, state->threshold * corr, state->threshold); - state->next_time += state->threshold / corr * 1e9 / state->rate; - state->last_threshold = state->threshold; - return 0; }