On Mon, 19 Jul 2010, Jaroslav Kysela wrote:
On Wed, 14 Jul 2010, melwyn lobo wrote:
Another query, if setting runtime parameters like: runtime->silence_threshold = runtime->boundary; runtime->silence_size = runtime->boundary; runtime->stop_threshold = runtime->boundary;
Also to avoid the bug in snd_pcm_playback_silence() i.e., snd_BUG_ON(frames > runtime->buffer_size), I have added a tweak in the driver IRQ handler:
This patch might fix this problem:
diff --git a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c index bcf95d3..e23e0e7 100644 --- a/sound/core/pcm_lib.c +++ b/sound/core/pcm_lib.c @@ -67,6 +67,8 @@ void snd_pcm_playback_silence(struct snd_pcm_substream *substream, snd_pcm_ufram } else { if (new_hw_ptr == ULONG_MAX) { /* initialization */ snd_pcm_sframes_t avail = snd_pcm_playback_hw_avail(runtime);
if (avail > runtime->buffer_size)
avail = runtime->buffer_size; runtime->silence_filled = avail > 0 ? avail : 0; runtime->silence_start = (runtime->status->hw_ptr + runtime->silence_filled) %
But it looks that you do something wrong with hw_ptr or appl_ptr in your driver, because this condition would be true only when an large underrun occurs immediatelly.
Not underrun but overfill (but this should not occur - the PCM core functions check for this). Could you print appl_ptr, hw_ptr and buffer_size before you call snd_pcm_elapsed()?
Jaroslav
----- Jaroslav Kysela perex@perex.cz Linux Kernel Sound Maintainer ALSA Project, Red Hat, Inc.