aboutsummaryrefslogtreecommitdiffstats
path: root/sound/core
diff options
context:
space:
mode:
authorJaroslav Kysela <perex@perex.cz>2009-05-28 06:31:56 -0400
committerTakashi Iwai <tiwai@suse.de>2009-05-29 05:47:40 -0400
commita4444da31ec92f89cd6923579c20a9c240439cfc (patch)
treec379a1cd9f0cc1ecc64f7c60a17e76096310cfce /sound/core
parent13f040f9e55d41e92e485389123654971e03b819 (diff)
ALSA: PCM midlevel: lower jiffies check margin using runtime->delay value
When hardware has large FIFO, it is necessary to lower jiffies margin by count of queued samples. Signed-off-by: Jaroslav Kysela <perex@perex.cz> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/core')
-rw-r--r--sound/core/pcm_lib.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c
index 0f299a5ad6da..dd9126b92c19 100644
--- a/sound/core/pcm_lib.c
+++ b/sound/core/pcm_lib.c
@@ -263,6 +263,9 @@ static int snd_pcm_update_hw_ptr_interrupt(struct snd_pcm_substream *substream)
263 if (runtime->hw.info & SNDRV_PCM_INFO_BATCH) 263 if (runtime->hw.info & SNDRV_PCM_INFO_BATCH)
264 goto no_jiffies_check; 264 goto no_jiffies_check;
265 hdelta = new_hw_ptr - old_hw_ptr; 265 hdelta = new_hw_ptr - old_hw_ptr;
266 if (hdelta < runtime->delay)
267 goto no_jiffies_check;
268 hdelta -= runtime->delay;
266 jdelta = jiffies - runtime->hw_ptr_jiffies; 269 jdelta = jiffies - runtime->hw_ptr_jiffies;
267 if (((hdelta * HZ) / runtime->rate) > jdelta + HZ/100) { 270 if (((hdelta * HZ) / runtime->rate) > jdelta + HZ/100) {
268 delta = jdelta / 271 delta = jdelta /
@@ -349,8 +352,12 @@ int snd_pcm_update_hw_ptr(struct snd_pcm_substream *substream)
349 new_hw_ptr = hw_base + pos; 352 new_hw_ptr = hw_base + pos;
350 } 353 }
351 /* Do jiffies check only in xrun_debug mode */ 354 /* Do jiffies check only in xrun_debug mode */
352 if (xrun_debug(substream, 4) && 355 if (!xrun_debug(substream, 4))
353 ((delta * HZ) / runtime->rate) > jdelta + HZ/100) { 356 goto no_jiffies_check;
357 if (delta < runtime->delay)
358 goto no_jiffies_check;
359 delta -= runtime->delay;
360 if (((delta * HZ) / runtime->rate) > jdelta + HZ/100) {
354 hw_ptr_error(substream, 361 hw_ptr_error(substream,
355 "hw_ptr skipping! " 362 "hw_ptr skipping! "
356 "(pos=%ld, delta=%ld, period=%ld, jdelta=%lu/%lu)\n", 363 "(pos=%ld, delta=%ld, period=%ld, jdelta=%lu/%lu)\n",
@@ -359,6 +366,7 @@ int snd_pcm_update_hw_ptr(struct snd_pcm_substream *substream)
359 ((delta * HZ) / runtime->rate)); 366 ((delta * HZ) / runtime->rate));
360 return 0; 367 return 0;
361 } 368 }
369 no_jiffies_check:
362 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK && 370 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK &&
363 runtime->silence_size > 0) 371 runtime->silence_size > 0)
364 snd_pcm_playback_silence(substream, new_hw_ptr); 372 snd_pcm_playback_silence(substream, new_hw_ptr);