[alsa-devel] snd_pcm_hw_params_set_buffer_time_near: invalid argument

Jean-Yves Avenard jyavenard at gmail.com
Wed Mar 9 13:23:41 CET 2011


Hi

On Wednesday, 9 March 2011, Raymond Yau <superquad.vortex2 at gmail.com> wrote:

> hda-intel.c only allocate 64Kbytes
>
>     /* buffer pre-allocation */
>     snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV_SG,
>                           snd_dma_pci_data(chip->pci),
>                           1024 * 64, 32 * 1024 * 1024);
>
> user or distribution need to change "prealloc" from 64 to a higher value for
> getting 500ms buffer
>
> echo 1024 > /proc/asound/Intel/pcm0p/sub0/prealloc

It seems you misunderstood my first message.

For a start, the default memory allocated to alsa in ubuntu is 4096kB.
so the amount of ram isn't the problem.

Setting a buffer of
200ms: ok
300ms: ok
400ms: not ok (invalid argument)
500ms: ok

Why would 400ms gives invalid argument, when 500ms doesn't nor 300.
Memory available is obviously not the issue.

If only 64kB is allocated, requesting 200ms gives you 200ms
300ms -> 300ms
400ms -> invalid argument
500ms -> 371ms
600ms -> 371ms

You would assume that requesting 400ms would work or return what can
fit in what has been pre-allocated.

Jy


More information about the Alsa-devel mailing list