[alsa-devel] snd_pcm_hw_params_set_buffer_time_near: invalid argument

Raymond Yau superquad.vortex2 at gmail.com
Mon Mar 7 13:24:28 CET 2011


2011/3/6 Jean-Yves Avenard <jyavenard at gmail.com>

> Hi there.
>
> I'm a bit puzzled as to what values are considered valids and which
> one aren't when it comes to setting the buffer time with
> snd_pcm_hw_params_set_buffer_time_near.
>
> For example setting a value of 295ms : all ok. From 300ms to 450ms ->
> "Invalid argument".
> but 500ms for example is okay.
>
> What's the logic behind it ?
> It's obviously related to the sampling rate, the audio format and the
> number of channels ; as the values giving me "Invalid argument" change
> then.
>
> Any comments would be greatly appreciated.
>
> Thanks!
> JY
>

This seem to be bug in alsa-lib as I can reproduce using alsa-lib/test/pcm.c
with buffer time 120000 and my hda codec support both 11025Hz and 22050Hz

using buffer time 160000 is OK


./pcm -Dhw:CARD=Intel,DEV=0 -b 120000  -r 22050 -c 2
Playback device is hw:CARD=Intel,DEV=0
Stream parameters are 22050Hz, S16_LE, 2 channels
Sine wave rate is 440.0000Hz
Using transfer method: write
Unable to set buffer time 120000 for playback: Invalid argument
Setting of hwparams failed: Invalid argument


 ./pcm -Dhw:CARD=Intel,DEV=0 -b 120000  -r 11025 -c 2
Playback device is hw:CARD=Intel,DEV=0
Stream parameters are 11025Hz, S16_LE, 2 channels
Sine wave rate is 440.0000Hz
Using transfer method: write
Unable to set buffer time 120000 for playback: Invalid argument
Setting of hwparams failed: Invalid argument



./pcm -Dhw:CARD=Intel,DEV=0 -b 160000  -r 11025 -c 2
Playback device is hw:CARD=Intel,DEV=0
Stream parameters are 11025Hz, S16_LE, 2 channels
Sine wave rate is 440.0000Hz
Using transfer method: write


More information about the Alsa-devel mailing list