alsa: dynamically adjust the DLL bandwidth

Keep a running average and variance of the error. Use this to
periodically update the DLL bandwidth. When the variance gets smaller,
we update the DLL more slowly to stay closer to the ideal rate.

This seems to improve the rate stability.
This commit is contained in:
Wim Taymans 2024-10-04 10:47:47 +02:00
parent d1efc9c2c6
commit 0db2171cd9
2 changed files with 17 additions and 5 deletions

View file

@ -244,6 +244,7 @@ struct state {
struct spa_dll dll;
double max_error;
double max_resync;
double err_avg, err_var, err_wdw;
struct spa_latency_info latency[2];
struct spa_process_latency_info process_latency;