alsa: relax htimestamp threshold a little

Only assume an error when larger than 3 times the expected size. Clamp
to the threshold to not cause excessive delay compensation.
This commit is contained in:
Wim Taymans 2023-07-05 11:31:38 +02:00
parent 895e516a75
commit 937a13d93f

View file

@ -2015,8 +2015,8 @@ static int get_avail(struct state *state, uint64_t current_time, snd_pcm_uframes
spa_log_trace_fp(state->log, "%"PRIu64" %"PRIu64" %"PRIi64, current_time, then, diff);
if (SPA_ABS(diff) < state->threshold) {
*delay += diff;
if (SPA_ABS(diff) < state->threshold * 3) {
*delay += SPA_CLAMP(diff, -state->threshold, state->threshold);
state->htimestamp_error = 0;
} else {
if (++state->htimestamp_error > MAX_HTIMESTAMP_ERROR) {