>> >> 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 > > Then, How I can avoid under-run? I mean, If I attempt to write data in a buffer and the under-run occurs, It takes a long time to recover the pcm and the data must be lost. ¿how I can put silence in buffer instead of lost data? Did your program work when using alsa hw device instead of pulse plugin ? Did you get back the period size after snd_pcm_hw_params()? You need to keep at least one period of data in alsa buffer at any time if the sound card just increment hwptr by one period when interrupt occur It look like bug in your decode and write loop since alsa-pulse plugin won't report underrun by default http://git.alsa-project.org/?p=alsa-plugins.git;a=commit;h=c20d516e229620129ee20175d8fee8511cc3a4bd Do you mean your input source always provide data less than the specified rate ? > I have set the snd_pcm_sw_params_set_stop_threshold() to the boundary value also, but the under-run occurs > > My Playback PCM now: > > INFO: Using "default" device. > > ALSA <-> PulseAudio PCM I/O Plugin > Its setup is: > stream : PLAYBACK > access : RW_INTERLEAVED > format : S16_LE > subformat : STD > channels : 2 > 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 : 720 > stop_threshold : 6485183463413514240 > > silence_threshold: 0 > silence_size : 6485183463413514240 > boundary : 6485183463413514240 > > -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.freedesktop.org/archives/pulseaudio-discuss/attachments/20150423/61d9da32/attachment.html>