[alsa-devel] snd_pcm_avail_update returns 0
Jaroslav Kysela
perex at perex.cz
Thu Jan 14 16:31:10 CET 2010
On Thu, 14 Jan 2010, Singaravelan Nallasellan wrote:
> Thanks for the response.
>
> I am using mmap for the playback. What is the return value of
> snd_pcm_avail_update when the ring buffer is empty?
ring buffer size
> How does ALSA identify the empty buffer?
hw_ptr == appl_ptr
> We incremented the hardware pointer continuously to large value more
> than the hw buffer size. ALSA core did not round of the hw_ptr
> properly. The firmware in the audio engine is now rounding of hw ptr
> in the audio engine itself. It will always report the hw ptr between 0
> and hw buffer size.
hw_ptr and appl_ptr are from range 0..boundary to detect xruns. The driver
should not write to these values and should track own pointers.
> Moreover our driver uses the batch mode and updates the hardware
> pointer for every period. Is it the right way to do?
I'm not sure about what pointers you're talking. If it's hw_ptr and
appl_ptr, then driver shouldn't write to these pointers. The
snd_pcm_period_elapsed() function should be called to synchronize hw_ptr
when playback of period is finished.
Maybe you can put your code to a public place so we can check it.
Jaroslav
-----
Jaroslav Kysela <perex at perex.cz>
Linux Kernel Sound Maintainer
ALSA Project, Red Hat, Inc.
More information about the Alsa-devel
mailing list