[alsa-devel] snd_pcm_hw_params_set_buffer_time_near: invalid argument

Raymond Yau superquad.vortex2 at gmail.com
Wed Mar 9 04:52:34 CET 2011


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

> On 7 March 2011 23:24, Raymond Yau <superquad.vortex2 at gmail.com> wrote:
>
> > 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
>
> Yes.. It's hard to understand why 120ms wouldn't be okay, but 160ms would.
>
> Could you check is 400ms works for you ? I found this to be a value
> that generally do not work when using 44.1kHz 6 channels audio.
>
> For the time being, I made my application use 500ms buffer; this is
> what many media players are using (including mplayer) , so I'm
> guessing it would be fine under most circumstances otherwise we would
> have heard about it before.
>
> Jean-Yves
>

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


More information about the Alsa-devel mailing list