mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-29 05:40:27 -04:00
alsa: after a resync, reset the dll
Otherwise we might still be overcompensating for the previous errors and generate more errors. Fixes #3584
This commit is contained in:
parent
6b8c267e91
commit
a595d3dddb
1 changed files with 15 additions and 11 deletions
|
|
@ -2438,18 +2438,20 @@ static int alsa_write_sync(struct state *state, uint64_t current_time)
|
|||
else
|
||||
lev = SPA_LOG_LEVEL_INFO;
|
||||
|
||||
if ((suppressed = spa_ratelimit_test(&state->rate_limit, current_time)) >= 0) {
|
||||
spa_log_lev(state->log, lev, "%s: follower avail:%lu delay:%ld "
|
||||
"target:%ld thr:%u, resync (%d suppressed)",
|
||||
state->name, avail, delay,
|
||||
target, state->threshold, suppressed);
|
||||
}
|
||||
if ((suppressed = spa_ratelimit_test(&state->rate_limit, current_time)) < 0)
|
||||
lev = SPA_LOG_LEVEL_DEBUG;
|
||||
|
||||
spa_log_lev(state->log, lev, "%s: follower avail:%lu delay:%ld "
|
||||
"target:%ld thr:%u, resync (%d suppressed)",
|
||||
state->name, avail, delay,
|
||||
target, state->threshold, suppressed);
|
||||
|
||||
if (avail > target)
|
||||
snd_pcm_rewind(state->hndl, avail - target);
|
||||
else if (avail < target)
|
||||
spa_alsa_silence(state, target - avail);
|
||||
avail = target;
|
||||
spa_dll_init(&state->dll);
|
||||
state->alsa_sync = false;
|
||||
} else
|
||||
state->alsa_sync_warning = true;
|
||||
|
|
@ -2698,11 +2700,12 @@ static int alsa_read_sync(struct state *state, uint64_t current_time)
|
|||
else
|
||||
lev = SPA_LOG_LEVEL_INFO;
|
||||
|
||||
if ((suppressed = spa_ratelimit_test(&state->rate_limit, current_time)) >= 0) {
|
||||
spa_log_lev(state->log, lev, "%s: follower delay:%ld target:%ld thr:%u, "
|
||||
"resync (%d suppressed)", state->name, delay,
|
||||
target, state->threshold, suppressed);
|
||||
}
|
||||
if ((suppressed = spa_ratelimit_test(&state->rate_limit, current_time)) < 0)
|
||||
lev = SPA_LOG_LEVEL_DEBUG;
|
||||
|
||||
spa_log_lev(state->log, lev, "%s: follower delay:%ld target:%ld thr:%u "
|
||||
"resample:%d, resync (%d suppressed)", state->name, delay,
|
||||
target, state->threshold, state->resample, suppressed);
|
||||
|
||||
if (avail < target)
|
||||
max_read = target - avail;
|
||||
|
|
@ -2711,6 +2714,7 @@ static int alsa_read_sync(struct state *state, uint64_t current_time)
|
|||
avail = target;
|
||||
}
|
||||
state->alsa_sync = false;
|
||||
spa_dll_init(&state->dll);
|
||||
} else
|
||||
state->alsa_sync_warning = true;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue