[alsa-devel] Available frames > buffer size

Rob Duncan rduncan at teslamotors.com
Thu Dec 10 22:24:56 CET 2015


On Dec 10, 2015, at 11:24 AM, Clemens Ladisch <clemens at ladisch.de> wrote:
> 
> Rob Duncan wrote:
>> Is it ever correct for snd_pcm_avail() to return a value that’s greater
>> than that returned by snd_pcm_hw_params_get_buffer_size()?
> 
> Yes, but only if have disabled stop-on-underrun (by setting the
> stop_threshold to the boundary value).

Here’s the dump of my PCM:

stream       : PLAYBACK   
access       : RW_INTERLEAVED   
format       : S16_LE   
subformat    : STD   
channels     : 1   
rate         : 44100   
exact rate   : 44100 (44100/1)   
msbits       : 16   
buffer_size  : 4096   
period_size  : 1024   
period_time  : 23219   
tstamp_mode  : NONE   
tstamp_type  : MONOTONIC   
period_step  : 1   
avail_min    : 1024   
period_event : 0   
start_threshold  : 4096   
stop_threshold   : 4096   
silence_threshold: 0   
silence_size : 0   
boundary     : 1073741824

The stop_threshold is 4096 (i.e. not the boundary).

>> I call snd_pcm_recover() and then snd_pcm_avail() again and now I get
>> 4126 frames.
>> 
>> As you can see the time between these two logs is less than
>> 1 millisecond, so I don’t understand how the PCM can go from
>> 2080 frames available to >4096 frames available so quickly.
> 
> This sounds like a bug. Which version of alsa-lib are you using?

This was done with version 1.1.0, but I also get it 1.0.23.

Thanks,

Rob.


More information about the Alsa-devel mailing list