From: Shengjiu Wang Date: Mon, 14 Jul 2014 08:55:48 +0000 (+0800) Subject: pcm: rate: fix hw_ptr exceed the boundary X-Git-Tag: android-x86-9.0-r1~784 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=035f196bcdc1e9903ed52ad1859dc23d3aa74e72;p=android-x86%2Fexternal-alsa-lib.git pcm: rate: fix hw_ptr exceed the boundary For long time test case, the hw_ptr will exceed the boundary, then cause the avail size wrong. Signed-off-by: Shengjiu Wang Signed-off-by: Takashi Iwai --- diff --git a/src/pcm/pcm_rate.c b/src/pcm/pcm_rate.c index 7f667d4c..2563d824 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)