[alsa-devel] Finding the buffer fill level

Bankim Bhavsar bankim.bhavsar at gmail.com
Thu Feb 5 00:40:20 CET 2009

Hi Jaroslav,

I'm using following as the reference to find buffer fill-level of the
playback channel

* WRITE_TO_READ:  the current fill level of the playback buffer
- buffer_size - snd_pcm_avail_update()


Infact I use snd_pcm_hwsync() before calling snd_pcm_avail_update() (
I know I can use snd_pcm_avail() but thats only available 1.0.18

I use snd_pcm_set_buffer_size_near() to configure the hw params and
save the returned value of bufffer_size to find the buffer fill level
later on. On some sound cards
( snd_pcm_avail_update()  > buffer_size) which shouldn't be the case!
This throws off our internal polling calculations.

Information about the Linux hosts and sound cards where we've seen this issue.

Ubuntu 8.10 x64 host with kernel version 2.6.27-11-generic
Alsa lib version 1.0.17a

1) **** List of PLAYBACK Hardware Devices ****
card 0: Intel [HDA Intel], device 0: AD198x Analog [AD198x Analog]

2) **** List of PLAYBACK Hardware Devices ****
card 0: Intel [HDA Intel], device 0: ALC885 Analog [ALC885 Analog]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: Intel [HDA Intel], device 1: ALC885 Digital [ALC885 Digital]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

Is this a known issue?

Let me know if you need more information. Or there is an alternative


More information about the Alsa-devel mailing list