mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2025-11-06 13:29:59 -05:00
pcm: plugin - fix avail_min calculation on rate plugin
commit88e4ae27,ff1f669dintroduced a dynamic recalculation of the slave's avail_min value. The calculated avail_min setting did not take into account, that the avail_min value depends on the used sampling rate and must be adapted accordingly if the slave is using a different sampling rate. That leads to too large/too small calculated avail_min settings and inaccurate period wake-up events if a rate converter plugin is used. This patch is adapting the avail_min calculation to consider a different sampling rate between actual pcm and it's slave. Fixes: https://github.com/alsa-project/alsa-lib/pull/218 Signed-off-by: Andreas Pape <apape@de.adit-jv.com> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
parent
ea15c83525
commit
d21e0e01c6
3 changed files with 31 additions and 0 deletions
|
|
@ -614,6 +614,14 @@ int snd_pcm_plugin_may_wait_for_avail_min(snd_pcm_t *pcm,
|
|||
return 0;
|
||||
|
||||
needed_slave_avail_min = pcm->avail_min - available;
|
||||
|
||||
/* proportional adaption if rate converter is in place..
|
||||
* Can happen only on built-in rate plugin.
|
||||
* This code is also used by extplug, but extplug does not allow to alter the sampling rate.
|
||||
*/
|
||||
if (snd_pcm_type(pcm) == SND_PCM_TYPE_RATE)
|
||||
needed_slave_avail_min = snd_pcm_rate_slave_frames(pcm, needed_slave_avail_min);
|
||||
|
||||
if (slave->avail_min != needed_slave_avail_min) {
|
||||
snd_pcm_sw_params_t *swparams;
|
||||
snd_pcm_sw_params_alloca(&swparams);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue