diff options
author | Jaroslav Kysela <perex@perex.cz> | 2010-10-14 21:46:12 +0200 |
---|---|---|
committer | Jaroslav Kysela <perex@perex.cz> | 2010-10-14 21:54:17 +0200 |
commit | 0db710230589b5571c23f59250eabc9504b17c98 (patch) | |
tree | df808481c37cd38f1df0f1614313a0ba834ace32 /sound/drivers | |
parent | 838c364ff05c143fd1810e8ad1469935d6c23a7a (diff) | |
download | op-kernel-dev-0db710230589b5571c23f59250eabc9504b17c98.zip op-kernel-dev-0db710230589b5571c23f59250eabc9504b17c98.tar.gz |
ALSA: snd-aloop - fix issue in the timer start function
In some circumstances (the rate shift value was changed), the irq_pos
value may be higher than the fraction value in the timer start function.
Check for it.
Also, to avoid value overflow, decrease maximum period size.
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Diffstat (limited to 'sound/drivers')
-rw-r--r-- | sound/drivers/aloop.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/sound/drivers/aloop.c b/sound/drivers/aloop.c index 3c00882..838ad863 100644 --- a/sound/drivers/aloop.c +++ b/sound/drivers/aloop.c @@ -171,6 +171,10 @@ static void loopback_timer_start(struct loopback_pcm *dpcm) dpcm->pcm_rate_shift = rate_shift; dpcm->period_size_frac = frac_pos(dpcm, dpcm->pcm_period_size); } + if (dpcm->period_size_frac <= dpcm->irq_pos) { + dpcm->irq_pos %= dpcm->period_size_frac; + dpcm->period_update_pending = 1; + } tick = dpcm->period_size_frac - dpcm->irq_pos; tick = (tick + dpcm->pcm_bps - 1) / dpcm->pcm_bps; dpcm->timer.expires = jiffies + tick; @@ -531,7 +535,9 @@ static struct snd_pcm_hardware loopback_pcm_hardware = .channels_max = 32, .buffer_bytes_max = 2 * 1024 * 1024, .period_bytes_min = 64, - .period_bytes_max = 2 * 1024 * 1024, + /* note check overflow in frac_pos() using pcm_rate_shift before + changing period_bytes_max value */ + .period_bytes_max = 1024 * 1024, .periods_min = 1, .periods_max = 1024, .fifo_size = 0, |