mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-29 05:40:27 -04:00
alsa-pcm: Lower the frequency of USB gadget rate updates
While the spec allows for 1ppm changes, our rate matching logic applies these changes quite often, which can be spammy on USB. I haven't seen hosts mind this, but it seems like it might be a problem at some point. Additionally, if we also have bind ctls enabled, every pitch update is also a wakeup for ourselves (whether or not we're listening for the pitch ctls, since the mixer fd does not distinguish between ctls, those are filtered after we wake up). The 10ppm threshold is empirically tested as being not "too noisy" (i.e. when updates happen, I can see them scroll by with `amixer events`). If necessary, we can make this configurable in the future.
This commit is contained in:
parent
0c5b2f1154
commit
9cd2bbc585
1 changed files with 4 additions and 2 deletions
|
|
@ -2352,8 +2352,10 @@ int spa_alsa_update_rate_match(struct state *state)
|
|||
last_pitch = (uint64_t)(1000000 / state->last_rate);
|
||||
}
|
||||
|
||||
/* The pitch adjustment is limited to 1 ppm */
|
||||
if (pitch == last_pitch)
|
||||
/* The pitch adjustment is limited to 1 ppm according to the spec, but
|
||||
* let's avoid very granular changes so that we don't spam the host
|
||||
* (and ourselves, if bind-ctls are enabled). */
|
||||
if (SPA_ABS((int)pitch - (int)last_pitch) < 10)
|
||||
return 0;
|
||||
|
||||
snd_ctl_elem_value_set_integer(state->pitch_elem, 0, pitch);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue