[alsa-devel] Playback - Overwrite buffer with silence

Raymond Yau superquad.vortex2 at gmail.com
Fri Apr 17 02:57:17 CEST 2015


>>
>> The allowed values of the hardware parameters depend on the hardware's
>> capabilities.
>
>
> OK but, overwrite the buffer with silence depend of software, no? Why the
buffer is not overwrite with silence with this pcm setup? It is as
documentation.
>
> PCM:
>
> ALSA <-> PulseAudio PCM I/O Plugin
> Its setup is:
>   stream       : PLAYBACK
>   access       : RW_INTERLEAVED
>   format       : S16_LE
>   subformat    : STD
>   channels     : 1
>   rate         : 48000
>   exact rate   : 48000 (48000/1)
>   msbits       : 16
>   buffer_size  : 720
>   period_size  : 240
>   period_time  : 5000
>   tstamp_mode  : NONE
>   period_step  : 1
>   avail_min    : 240
>   period_event : 0
>   start_threshold  : 240
>   stop_threshold   : 720
>   silence_threshold: 0
>   silence_size : 6485183463413514240
>   boundary     : 6485183463413514240
>
>

Pulse plugin 's minimum periods is three.

len = decoder(&decoded_data,t_data);

pcmreturn = snd_pcm_writei(pcm_handle, decoded_data, len);/*In most cases
there are UNDERRUN...*/

If  len > 720 (buffer_size), you need to write three periods, start
playback,  receive data, peform decode while waiting for the sound
card/plugin playback one period and write another period

Pulseaudio is a sound server which mix several playback streams, silence
size may has no effect since the alsa sink may use different period
size/buffer size or disable period wakeup when using timer scheduling


More information about the Alsa-devel mailing list