alsa: fix threshold sign

Be careful when converting the uint32_t to int64_t, first convert and
then flip the sign.
This commit is contained in:
Wim Taymans 2023-07-05 12:01:08 +02:00
parent 937a13d93f
commit 159fa7177a

View file

@ -2016,7 +2016,7 @@ 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 * 3) {
*delay += SPA_CLAMP(diff, -state->threshold, state->threshold);
*delay += SPA_CLAMP(diff, -((int64_t)state->threshold), (int64_t)state->threshold);
state->htimestamp_error = 0;
} else {
if (++state->htimestamp_error > MAX_HTIMESTAMP_ERROR) {