[alsa-devel] [PATCH] pcm: rate: fix hw_ptr exceed the boundary

Takashi Iwai tiwai at suse.de
Mon Jul 14 17:34:49 CEST 2014


At Mon, 14 Jul 2014 16:55:48 +0800,
Shengjiu Wang wrote:
> 
> For long time test case, the hw_ptr will exceed the boundary, then cause
> the avail size wrong.
> 
> Signed-off-by: Shengjiu Wang <shengjiu.wang at freescale.com>

Thanks, applied.


Takashi

> ---
>  src/pcm/pcm_rate.c |    2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/src/pcm/pcm_rate.c b/src/pcm/pcm_rate.c
> index 7f667d4..2563d82 100644
> --- a/src/pcm/pcm_rate.c
> +++ b/src/pcm/pcm_rate.c
> @@ -574,6 +574,8 @@ static inline void snd_pcm_rate_sync_hwptr(snd_pcm_t *pcm)
>  	rate->hw_ptr =
>  		(slave_hw_ptr / rate->gen.slave->period_size) * pcm->period_size +
>  		rate->ops.input_frames(rate->obj, slave_hw_ptr % rate->gen.slave->period_size);
> +
> +	rate->hw_ptr %= pcm->boundary;
>  }
>  
>  static int snd_pcm_rate_hwsync(snd_pcm_t *pcm)
> -- 
> 1.7.9.5
> 


More information about the Alsa-devel mailing list