[alsa-devel] [ALSA patch] [PATCH 3/5] pcm: dsnoop: Added "hw_ptr_alignment" option in configuration for slave pointer alignment

Takashi Iwai tiwai at suse.de
Thu May 2 17:59:42 CEST 2019


On Tue, 30 Apr 2019 09:38:41 +0200,
<vanitha.channaiah at in.bosch.com> wrote:
> 
> From: Vanitha Channaiah <vanitha.channaiah at in.bosch.com>
> 
> snd_pcm_wait() is waiting for longer time more than two periodic size as
> avail is less than avail_min by few frames.
> This is because the hw_ptr read from the kernel during snd_pcm_start()
> is not period aligned which is ahead of few (Nperiod + 1)frames.
> 
> Signed-off-by: Vanitha Channaiah <vanitha.channaiah at in.bosch.com>

Ditto as patch 2, the description is too ambiguous, and the update of
documentation is missing.

And...

> --- a/src/pcm/pcm_direct.c
> +++ b/src/pcm/pcm_direct.c
> @@ -2043,11 +2043,12 @@ int snd_pcm_direct_parse_open_conf(snd_config_t *root, snd_config_t *conf,
>  
>  void snd_pcm_direct_reset_slave_ptr(snd_pcm_t *pcm, snd_pcm_direct_t *dmix)
>  {
> -	dmix->slave_appl_ptr = dmix->slave_hw_ptr = *dmix->spcm->hw.ptr;
> -
> +	/* For buffer size less than two period size, the start position
> +	 * of slave app ptr is rounded up in order to avoid xruns
> +	 */
>  	if (dmix->hw_ptr_alignment == SND_PCM_HW_PTR_ALIGNMENT_ROUNDUP ||
>  		(dmix->hw_ptr_alignment == SND_PCM_HW_PTR_ALIGNMENT_AUTO &&
> -		pcm->buffer_size <= pcm->period_size * 2))
> +		pcm->buffer_size < pcm->period_size * 2))
>  		dmix->slave_appl_ptr =
>  			((dmix->slave_appl_ptr + dmix->slave_period_size - 1) /
>  			dmix->slave_period_size) * dmix->slave_period_size;

It's not good to change the helper function semantics out of sudden,
even without any description.


thanks,

Takashi


More information about the Alsa-devel mailing list