[alsa-devel] snd_pcm_set_params faild on set_buffer_time_near and set_period_time_near

Raymond Yau superquad.vortex2 at gmail.com
Mon Jul 27 10:36:56 CEST 2015


2015-7-27 下午3:12於 "Martin Geier" <martin.geier at streamunlimited.com>寫道:
>
> Hi Raymond,
>
> Output parameters with custom logs:
> set_buffer_time_near: -22
> set period time: 12517
> get period size: 276
> set buffer size: 1104
> get buffer size: 1104
>
>
> ACCESS:  RW_INTERLEAVED
> FORMAT:  S16_LE
> SUBFORMAT:  STD
> SAMPLE_BITS: 16
> FRAME_BITS: 32
> CHANNELS: 2
> RATE: 22050
> PERIOD_TIME: (12517 12518)
> PERIOD_SIZE: 276
> PERIOD_BYTES: 1104
> PERIODS: 4
> BUFFER_TIME: (50068 50069)
> BUFFER_SIZE: 1104
> BUFFER_BYTES: 4416
>
> What do you mean, are latency always <= 50ms? In what cases?

http://www.alsa-project.org/alsa-doc/alsa-lib/group___p_c_m.html#ga45d50841b307f2156fce1857bfac228c

Set the hardware and software parameters in a simple way.
Parameters:pcm PCM handle
format required PCM format
access required PCM access
channels required PCM channels
rate required sample rate in Hz
soft_resample 0 = disallow alsa-lib resample stream, 1 = allow resampling
latency required overall latency in us

Refer to your result seem latency only close to 50ms


More information about the Alsa-devel mailing list