[alsa-devel] snd_pcm_hw_params_set_buffer_time_near: invalid argument
perex at perex.cz
Wed Mar 9 13:29:42 CET 2011
On Wed, 9 Mar 2011, Jean-Yves Avenard wrote:
> 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,
>> 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.
What is your dir argument (last one) for the near functions? If it's NULL
or value is zero, it means you request the exact value which may not be
available. Use -1 to request specified or smaller value or 1 to request
specified or bigger value.
Jaroslav Kysela <perex at perex.cz>
Linux Kernel Sound Maintainer
ALSA Project, Red Hat, Inc.
More information about the Alsa-devel