alsa: CLAMP the error just in case something goes wrong.

The calculation of the elapsed time is actually not a good idea because
it becomes larger and larger and a tiny change in the rate could result
in a large difference that would make things fail quickly.

Until that is fixed, this patch will need to do..
This commit is contained in:
Wim Taymans 2021-09-02 17:31:02 +02:00
parent 5fa1ae99ae
commit c2c7dd040a

View file

@ -732,6 +732,7 @@ static int update_time(struct seq_state *state, uint64_t nsec, bool follower)
queue_elapsed = NSEC_TO_CLOCK(state->clock, state->queue_time) / corr;
err = ((int64_t)clock_elapsed - (int64_t) queue_elapsed);
err = SPA_CLAMP(err, -64, 64);
if (state->dll.bw == 0.0) {
spa_dll_set_bw(&state->dll, SPA_DLL_BW_MAX, state->threshold,