[pulseaudio-discuss] snd_pcm_avail no reliable

golden magic.lixin at gmail.com
Mon Jun 8 19:50:41 PDT 2015


Hi all,

    I found some audio noise problem when I trying to set the sink 
latency to a lower value.

    here is the alsa dump:

     D/NMAudio ( 1959): Its setup is:
     D/NMAudio ( 1959):   stream       : PLAYBACK
     D/NMAudio ( 1959):   access       : MMAP_INTERLEAVED
     D/NMAudio ( 1959):   format       : S16_LE
     D/NMAudio ( 1959):   subformat    : STD
     D/NMAudio ( 1959):   channels     : 2
     D/NMAudio ( 1959):   rate         : 22050
     D/NMAudio ( 1959):   exact rate   : 22050 (22050/1)
     D/NMAudio ( 1959):   msbits       : 16
     D/NMAudio ( 1959):   buffer_size  : 8192
     D/NMAudio ( 1959):   period_size  : 2048
     D/NMAudio ( 1959):   period_time  : 92879
     D/NMAudio ( 1959):   tstamp_mode  : ENABLE
     D/NMAudio ( 1959):   period_step  : 1
     D/NMAudio ( 1959):   avail_min    : 7751
     D/NMAudio ( 1959):   period_event : 0
     D/NMAudio ( 1959):   start_threshold  : -1
     D/NMAudio ( 1959):   stop_threshold   : 1073741824
     D/NMAudio ( 1959):   silence_threshold: 0
     D/NMAudio ( 1959):   s

    here is the log when problem happened:

E/NMAudio ( 1959): [1991] ( 355.00387| 0.000) pcm_avail = 30124 , 7531
     D/NMAudio ( 1959): [1991] ( 355.00387| 0.000) avail: 30124, 
left_to_play: 29.98ms, process_usec=20.00ms, max_sleep_usec=10.00ms
     D/NMAudio ( 1959): [1991] ( 355.00387| 0.000) Not filling up, 
because too early.
     D/NMAudio ( 1959): [1991][audioio] snd_pcm_avail[0][0xb344efa0]=7531
E/NMAudio ( 1959): [1991] ( 355.00387| 0.000) pcm_avail = 30124 , 7531
     D/NMAudio ( 1959): [1991] ( 355.00388| 0.000) avail: 30124, 
left_to_play: 29.98ms, process_usec=20.00ms, max_sleep_usec=10.00ms
     D/NMAudio ( 1959): [1991] ( 355.00388| 0.000) Not filling up, 
because too early.
     D/NMAudio ( 1959): [1991][audioio] snd_pcm_avail[0][0xb344efa0]=7531
E/NMAudio ( 1959): [1991] ( 355.00388| 0.000) pcm_avail = 30124 , 7531
     D/NMAudio ( 1959): [1991] ( 355.00388| 0.000) avail: 30124, 
left_to_play: 29.98ms, process_usec=20.00ms, max_sleep_usec=10.00ms
     D/NMAudio ( 1959): [1991] ( 355.00388| 0.000) Not filling up, 
because too early.
     D/NMAudio ( 1959): [1991][audioio] snd_pcm_avail[0][0xb344efa0]=7531
E/NMAudio ( 1959): [1991] ( 355.00388| 0.000) pcm_avail = 30124 , 7531
     D/NMAudio ( 1959): [1991] ( 355.00388| 0.000) avail: 30124, 
left_to_play: 29.98ms, process_usec=20.00ms, max_sleep_usec=10.00ms
     D/NMAudio ( 1959): [1991] ( 355.00388| 0.000) Not filling up, 
because too early.
     D/NMAudio ( 1959): [1991][audioio] snd_pcm_avail[0][0xb344efa0]=7531
E/NMAudio ( 1959): [1991] ( 355.00388| 0.000) pcm_avail = 30124 , 7531
     D/NMAudio ( 1959): [1991] ( 355.00388| 0.000) avail: 30124, 
left_to_play: 29.98ms, process_usec=20.00ms, max_sleep_usec=10.00ms
     D/NMAudio ( 1959): [1991] ( 355.00388| 0.000) Not filling up, 
because too early.
     D/NMAudio ( 1959): [1991][audioio] snd_pcm_avail[0][0xb344efa0]=7531
E/NMAudio ( 1959): [1991] ( 355.00388| 0.000) pcm_avail = 30124 , 7531
     D/NMAudio ( 1959): [1991] ( 355.00388| 0.000) avail: 30124, 
left_to_play: 29.98ms, process_usec=20.00ms, max_sleep_usec=10.00ms
     D/NMAudio ( 1959): [1991] ( 355.00388| 0.000) Not filling up, 
because too early.
     D/NMAudio ( 1959): [1991][audioio] snd_pcm_avail[0][0xb344efa0]=7531
E/NMAudio ( 1959): [1991] ( 355.00388| 0.000) pcm_avail = 30124 , 7531
     D/NMAudio ( 1959): [1991] ( 355.00388| 0.000) avail: 30124, 
left_to_play: 29.98ms, process_usec=20.00ms, max_sleep_usec=10.00ms
     D/NMAudio ( 1959): [1991] ( 355.00388| 0.000) Not filling up, 
because too early.
     D/NMAudio ( 1959): [1991][audioio] snd_pcm_avail[0][0xb344efa0]=7531
E/NMAudio ( 1959): [1991] ( 355.00399| 0.010) pcm_avail = 30124 , 7531
     D/NMAudio ( 1959): [1991] ( 355.00399| 0.000) avail: 30124, 
left_to_play: 29.98ms, process_usec=20.00ms, max_sleep_usec=10.00ms
     D/NMAudio ( 1959): [1991] ( 355.00399| 0.000) Not filling up, 
because too early.
     D/NMAudio ( 1959): [1991][audioio] snd_pcm_avail[0][0xb344efa0]=7531
E/NMAudio ( 1959): [1991] ( 355.00405| 0.005) pcm_avail = 30124 , 7531
     D/NMAudio ( 1959): [1991] ( 355.00405| 0.000) avail: 30124, 
left_to_play: 29.98ms, process_usec=20.00ms, max_sleep_usec=10.00ms
     D/NMAudio ( 1959): [1991] ( 355.00405| 0.000) Not filling up, 
because too early.
     D/NMAudio ( 1959): [1991][audioio] snd_pcm_avail[0][0xb344efa0]=7531
E/NMAudio ( 1959): [1991] ( 355.00405| 0.000) pcm_avail = 30124 , 7531
     D/NMAudio ( 1959): [1991] ( 355.00405| 0.000) avail: 30124, 
left_to_play: 29.98ms, process_usec=20.00ms, max_sleep_usec=10.00ms
     D/NMAudio ( 1959): [1991] ( 355.00405| 0.000) Not filling up, 
because too early.
     D/NMAudio ( 1959): [1991] ( 355.00405| 0.000) Wakeup from ALSA!
     D/NMAudio ( 1959): [1991][audioio] snd_pcm_avail[0][0xb344efa0]=9579
E/NMAudio ( 1959): [1991] ( 355.00406| 0.000) pcm_avail = 38316 , 9579
     D/NMAudio ( 1959): [1991] ( 355.00406| 0.000) 
Underrun(sink-state=0)! (alsa-left=38316, whole-buffer=32768)
     I/NMAudio ( 1959): [1991] ( 355.00406| 0.000) Increasing minimal 
latency to 2.00 ms
     I/NMAudio ( 1959): [1991] ( 355.00406| 0.000) sink audioio.0 
latency range(2000, 371519)
     D/NMAudio ( 1959): [1991] ( 355.00406| 0.000) update_sw_params 
get_request_latency = 30000


     seems like snd_pcm_avail result is not so reliable

     first of all, the hw buffer size is set to 8192 frames, but in the 
red line, it became 9579.

     second, check the blue lines from time 355.00387 to 355.00405
      the snd_pcm_avail is always 7531 frames, this is 19 ms long, but 
snd_pcm_avail value is never changed, is it
     a problem ?

     Does anyone met this problem before? I would appreciate hearing 
your advice on this.
     Thanks!




BR,
Lixin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/pulseaudio-discuss/attachments/20150609/38dc296c/attachment.html>


More information about the pulseaudio-discuss mailing list