mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-29 05:40:27 -04:00
alsa: update resample state in all cases
We need to manually recheck the resample state when the matching state got updated.
This commit is contained in:
parent
5fba59b41d
commit
f2fb0b0aa5
1 changed files with 10 additions and 3 deletions
|
|
@ -2902,6 +2902,13 @@ static int update_time(struct state *state, uint64_t current_time, snd_pcm_sfram
|
|||
return 0;
|
||||
}
|
||||
|
||||
static bool need_resample(struct state *state)
|
||||
{
|
||||
return !state->pitch_elem &&
|
||||
((state->rate != 0 && state->driver_rate.denom != 0 &&
|
||||
(uint32_t)state->rate != state->driver_rate.denom) || state->matching);
|
||||
}
|
||||
|
||||
static int setup_matching(struct state *state)
|
||||
{
|
||||
state->matching = state->following;
|
||||
|
|
@ -2915,6 +2922,8 @@ static int setup_matching(struct state *state)
|
|||
if (spa_streq(state->position->clock.name, state->clock_name))
|
||||
state->matching = false;
|
||||
|
||||
state->resample = need_resample(state);
|
||||
|
||||
check_position_config(state, false);
|
||||
|
||||
recalc_headroom(state);
|
||||
|
|
@ -2974,9 +2983,7 @@ static inline int check_position_config(struct state *state, bool starting)
|
|||
state->max_error = SPA_MAX(256.0f, (state->threshold + state->headroom) / 2.0f);
|
||||
state->max_resync = SPA_MIN(state->threshold + state->headroom, state->max_error);
|
||||
state->err_wdw = (double)state->driver_rate.denom/state->driver_duration;
|
||||
state->resample = !state->pitch_elem &&
|
||||
((state->rate != 0 && state->driver_rate.denom != 0 &&
|
||||
(uint32_t)state->rate != state->driver_rate.denom) || state->matching);
|
||||
state->resample = need_resample(state);
|
||||
state->alsa_sync = true;
|
||||
}
|
||||
return 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue