On Wed, Jul 7, 2010 at 12:09 AM, Jaroslav Kysela perex@perex.cz wrote:
On Tue, 6 Jul 2010, melwyn lobo wrote:
done away with by using silence_size and silence_threshold. And if the application still does not get processor time for some reason, the hw_ptr will overrun the appl_ptr by more than buffer_size and trigger a bug in snd_pcm_playback_silence().
Could you fix (send us a patch) or describe exactly this problem?
Yes. It occurs in a loaded system. The hardware runs continously and eventually underruns (stop_threshold trigger does not occur because of its large value). Eventually due to silence_threshold, silence_size setting, snd_pcm_playback_silence() attempts to continously append silence. The function snd_pcm_playback_hw_avail(runtime) returns negative values. Now consider the code fragment; noise_dist = snd_pcm_playback_hw_avail(runtime) + runtime->silence_filled;
if (noise_dist >= (snd_pcm_sframes_t) runtime->silence_threshold) return; frames = runtime->silence_threshold - noise_dist;
which makes at some point frames > runtime->buffer_size and triggers
if (snd_BUG_ON(frames > runtime->buffer_size)) return;
This is my analysis as I can see the above statement getting executed. For this, the solution implemented in the driver, is to eventually stop the infinite DMA when appl_ptr <= hw_ptr.
Jaroslav
Jaroslav Kysela perex@perex.cz Linux Kernel Sound Maintainer ALSA Project, Red Hat, Inc.
Regards, M. Regards, M.