diff options
author | Jaroslav Kysela <perex@perex.cz> | 2009-05-28 12:31:56 +0200 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2009-05-29 11:47:40 +0200 |
commit | a4444da31ec92f89cd6923579c20a9c240439cfc (patch) | |
tree | c379a1cd9f0cc1ecc64f7c60a17e76096310cfce /sound/core/pcm_lib.c | |
parent | 13f040f9e55d41e92e485389123654971e03b819 (diff) | |
download | linux-stable-a4444da31ec92f89cd6923579c20a9c240439cfc.tar.gz linux-stable-a4444da31ec92f89cd6923579c20a9c240439cfc.tar.bz2 linux-stable-a4444da31ec92f89cd6923579c20a9c240439cfc.zip |
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/pcm_lib.c')
-rw-r--r-- | sound/core/pcm_lib.c | 12 |
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) if (runtime->hw.info & SNDRV_PCM_INFO_BATCH) goto no_jiffies_check; hdelta = new_hw_ptr - old_hw_ptr; + if (hdelta < runtime->delay) + goto no_jiffies_check; + hdelta -= runtime->delay; jdelta = jiffies - runtime->hw_ptr_jiffies; if (((hdelta * HZ) / runtime->rate) > jdelta + HZ/100) { delta = jdelta / @@ -349,8 +352,12 @@ int snd_pcm_update_hw_ptr(struct snd_pcm_substream *substream) new_hw_ptr = hw_base + pos; } /* Do jiffies check only in xrun_debug mode */ - if (xrun_debug(substream, 4) && - ((delta * HZ) / runtime->rate) > jdelta + HZ/100) { + if (!xrun_debug(substream, 4)) + goto no_jiffies_check; + if (delta < runtime->delay) + goto no_jiffies_check; + delta -= runtime->delay; + if (((delta * HZ) / runtime->rate) > jdelta + HZ/100) { hw_ptr_error(substream, "hw_ptr skipping! " "(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) ((delta * HZ) / runtime->rate)); return 0; } + no_jiffies_check: if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK && runtime->silence_size > 0) snd_pcm_playback_silence(substream, new_hw_ptr); |