mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-29 05:40:27 -04:00
alsa: improve target bandwidth calculation
Also use the average error to calculate the bandwidth. If we are not around 0, we should increase the bandwidth.
This commit is contained in:
parent
922efaf6ed
commit
22f0b858b1
1 changed files with 7 additions and 3 deletions
|
|
@ -2831,16 +2831,20 @@ static int update_time(struct state *state, uint64_t current_time, snd_pcm_sfram
|
|||
state->next_time += (uint64_t)(diff / corr * 1e9 / state->rate);
|
||||
|
||||
if (SPA_UNLIKELY((state->next_time - state->base_time) > BW_PERIOD)) {
|
||||
double bw;
|
||||
|
||||
state->base_time = state->next_time;
|
||||
|
||||
spa_log_debug(state->log, "%s: follower:%d match:%d rate:%f "
|
||||
bw = (fabs(state->err_avg) + sqrt(fabs(state->err_var)))/1000.0;
|
||||
|
||||
spa_log_info(state->log, "%s: follower:%d match:%d rate:%f "
|
||||
"bw:%f thr:%u del:%ld target:%ld err:%f max:%f var:%f:%f:%f",
|
||||
state->name, follower, state->matching,
|
||||
corr, state->dll.bw, state->threshold, delay, target,
|
||||
err, state->max_error, state->err_avg, state->err_var, state->err_wdw);
|
||||
err, state->max_error, state->err_avg, state->err_var, bw);
|
||||
|
||||
spa_dll_set_bw(&state->dll,
|
||||
SPA_CLAMPD(sqrt(state->err_var)/1000.0, 0.001, SPA_DLL_BW_MAX),
|
||||
SPA_CLAMPD(bw, 0.001, SPA_DLL_BW_MAX),
|
||||
state->threshold, state->rate);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue