#500: module_jack_sink + module-suspend-on-idle = xruns
--------------------------------+-------------------------------------------
 Reporter:  patra...@gmail.com  |       Owner:  lennart
     Type:  defect              |      Status:  new    
 Priority:  normal              |   Milestone:         
Component:  module-jack-*       |    Severity:  normal 
 Keywords:                      |  
--------------------------------+-------------------------------------------
 If I use pulseaudio over Jack with module-suspend-on-idle timeout=0, then
 JACK reports an xrun (tens of milliseconds) for each started or stopped
 stream. I.e., mplayer -ao pulse = xrun at start and xrun at the end of the
 song, mplayer -ao jack = no xruns.

 Software versions: pulseaudio 0.9.14, jackd 0.116.2.

 /etc/pulse/default.pa:
 {{{
 #!/usr/bin/pulseaudio -nF

 # this is for JACK that is automatically started by pulseaudio on the
 onboard HD audio chip
 load-module module-jack-sink sink_name="headphones"
 load-module module-jack-source source_name="mic"

 # This is for the PC speaker
 load-module module-alsa-sink device="hw:2" fragments=8 fragment_size=1024
 format="u8" rate=37286 channels=1 sink_name="pc_speaker"

 # This is a bad attempt to use a TV tuner
 load-module module-alsa-source device="hw:1" fragments=8
 fragment_size=1024 format="s16" rate=32000 source_name="tv_tuner"

 load-module module-esound-protocol-unix
 load-module module-native-protocol-unix

 load-module module-volume-restore
 load-module module-default-device-restore
 load-module module-suspend-on-idle timeout=0  # due to PC speaker

 set-default-sink headphones
 set-default-source mic
 }}}

 /etc/pulse/daemon.conf minus comments:
 {{{
 disallow-exit = yes
 high-priority = yes
 nice-level = -11
 realtime-scheduling = yes
 realtime-priority = 5
 exit-idle-time = -1
 module-idle-time = -1
 scache-idle-time = 20
 rlimit-rtprio = 20
 default-sample-format = s32le
 default-sample-rate = 96000
 default-sample-channels = 2
 default-fragments = 4
 default-fragment-size-msec = 2
 }}}

 /etc/jackdrc:
 {{{
 /usr/bin/jackd -R -t 4000 -T -d alsa -D hw:0 -r 96000 -i 2 -o 2 -n 3 -p
 512
 }}}

 pulseaudio --verbose prints:
 {{{
 a...@home ~ $ pulseaudio --verbose 2>&1 | tee pulseaudio.log
 I: caps.c: Limited capabilities successfully to CAP_SYS_NICE.
 I: caps.c: Dropping root privileges.
 I: caps.c: Limited capabilities successfully to CAP_SYS_NICE.
 I: main.c: We're in the group 'realtime', allowing high-priority
 scheduling.
 I: main.c: We're in the group 'realtime', allowing real-time scheduling.
 I: main.c: RLIMIT_RTPRIO is set to 21, allowing real-time scheduling.
 I: main.c: setrlimit(RLIMIT_NICE, (31, 31)) failed: Операция не
 позволяется
 I: core-util.c: Successfully gained nice level -11.
 I: main.c: Giving up CAP_NICE
 I: main.c: This is PulseAudio 0.9.14
 I: main.c: Page size is 4096 bytes
 I: main.c: Machine ID is d94a2c4669a29c52f4f3c581499069f2.
 I: main.c: Using runtime directory
 /home/aep/.pulse/d94a2c4669a29c52f4f3c581499069f2:runtime.
 I: main.c: Using state directory /home/aep/.pulse.
 I: main.c: Running in system mode: no
 I: main.c: Fresh high-resolution timers available! Bon appetit!
 jackd 0.116.2
 Copyright 2001-2005 Paul Davis and others.
 jackd comes with ABSOLUTELY NO WARRANTY
 This is free software, and you are welcome to redistribute it
 under certain conditions; see the file COPYING for details

 JACK compiled with System V SHM support.
 loading driver ..
 apparent rate = 96000
 creating alsa driver ... hw:0|hw:0|512|3|96000|2|2|nomon|swmeter|-|32bit
 control device hw:0
 configuring for 96000Hz, period = 512 frames (5.3 ms), buffer = 3 periods
 ALSA: final selected sample format for capture: 32bit integer little-
 endian
 ALSA: use 3 periods for capture
 ALSA: final selected sample format for playback: 32bit integer little-
 endian
 ALSA: use 3 periods for playback
 I: module-jack-sink.c: Successfully connected as 'PulseAudio JACK Sink'
 I: sink.c: Created sink 0 "headphones" with sample spec float32le 2ch
 96000Hz and channel map front-left,front-right
 I: source.c: Created source 0 "headphones.monitor" with sample spec
 float32le 2ch 96000Hz and channel map front-left,front-right
 I: core-util.c: Successfully enabled SCHED_FIFO scheduling for thread,
 with priority 5.
 I: module-jack-sink.c: JACK thread starting up.
 I: core-util.c: Successfully enabled SCHED_FIFO scheduling for thread,
 with priority 9.
 I: module-jack-sink.c: Connecting PulseAudio JACK Sink:front-left to
 system:playback_1
 I: module-jack-sink.c: Connecting PulseAudio JACK Sink:front-right to
 system:playback_2
 I: module.c: Loaded "module-jack-sink" (index: #0; argument:
 "sink_name="headphones"").
 I: module-jack-source.c: Successfully connected as 'PulseAudio JACK
 Source'
 I: source.c: Created source 1 "mic" with sample spec float32le 2ch 96000Hz
 and channel map front-left,front-right
 I: core-util.c: Successfully enabled SCHED_FIFO scheduling for thread,
 with priority 5.
 I: module-jack-source.c: JACK thread starting up.
 I: core-util.c: Successfully enabled SCHED_FIFO scheduling for thread,
 with priority 9.
 I: module-jack-source.c: connecting PulseAudio JACK Source:front-left to
 system:capture_1
 I: module-jack-source.c: connecting PulseAudio JACK Source:front-right to
 system:capture_2
 I: module.c: Loaded "module-jack-source" (index: #1; argument:
 "source_name="mic"").
 I: module-alsa-sink.c: Successfully opened device hw:2.
 I: module-alsa-sink.c: Successfully enabled mmap() mode.
 I: module-alsa-sink.c: Successfully enabled timer-based scheduling mode.
 I: alsa-util.c: Successfully attached to mixer 'hw:2'
 I: alsa-util.c: Using mixer control "Master".
 I: sink.c: Created sink 1 "pc_speaker" with sample spec u8 1ch 37286Hz and
 channel map mono
 I: source.c: Created source 2 "pc_speaker.monitor" with sample spec u8 1ch
 37286Hz and channel map mono
 I: module-alsa-sink.c: Using 2 fragments of size 37286 bytes, buffer time
 is 2000,00ms
 I: module-alsa-sink.c: Time scheduling watermark is 19,98ms
 I: module-alsa-sink.c: Volume ranges from 0 to 255.
 I: module-alsa-sink.c: Volume ranges from -10,00 dB to 18,05 dB.
 I: alsa-util.c: ALSA device lacks separate volumes control for channel
 'mono'
 I: module-alsa-sink.c: Using hardware volume control. Hardware dB scale
 supported.
 I: core-util.c: Successfully enabled SCHED_FIFO scheduling for thread,
 with priority 5.
 I: module-alsa-sink.c: Starting playback.
 I: module.c: Loaded "module-alsa-sink" (index: #2; argument:
 "device="hw:2" fragments=8 fragment_size=1024 format="u8" rate=37286
 channels=1 sink_name="pc_speaker"").
 I: module-alsa-source.c: Successfully opened device hw:1.
 I: module-alsa-source.c: Successfully enabled mmap() mode.
 I: module-alsa-source.c: Successfully enabled timer-based scheduling mode.
 I: alsa-util.c: Successfully attached to mixer 'hw:1'
 I: alsa-util.c: Cannot find mixer control "Capture".
 W: alsa-util.c: Cannot find fallback mixer control "Mic".
 I: source.c: Created source 3 "tv_tuner" with sample spec s16le 2ch
 32000Hz and channel map front-left,front-right
 I: module-alsa-source.c: Using 4 fragments of size 64000 bytes, buffer
 time is 2000,00ms
 I: module-alsa-source.c: Time scheduling watermark is 20,00ms
 I: core-util.c: Successfully enabled SCHED_FIFO scheduling for thread,
 with priority 5.
 I: module.c: Loaded "module-alsa-source" (index: #3; argument:
 "device="hw:1" fragments=8 fragment_size=1024 format="s16" rate=32000
 source_name="tv_tuner"").
 I: module.c: Loaded "module-esound-protocol-unix" (index: #4; argument:
 "").
 I: module.c: Loaded "module-native-protocol-unix" (index: #5; argument:
 "").
 I: module.c: Loaded "module-volume-restore" (index: #6; argument: "").
 I: module-default-device-restore.c: Restored default sink 'headphones'.
 I: module-default-device-restore.c: Restored default source 'mic'.
 I: module.c: Loaded "module-default-device-restore" (index: #7; argument:
 "").
 I: module.c: Loaded "module-suspend-on-idle" (index: #8; argument:
 "timeout=0").
 I: main.c: Daemon startup complete.
 I: module-suspend-on-idle.c: Source tv_tuner idle for too long, suspending
 ...
 I: module-alsa-source.c: Device suspended...
 I: module-suspend-on-idle.c: Source pc_speaker.monitor idle for too long,
 suspending ...
 I: module-suspend-on-idle.c: Source mic idle for too long, suspending ...
 I: module-suspend-on-idle.c: Source headphones.monitor idle for too long,
 suspending ...
 I: module-suspend-on-idle.c: Sink pc_speaker idle for too long, suspending
 ...
 I: module-alsa-sink.c: Device suspended...
 I: module-suspend-on-idle.c: Sink headphones idle for too long, suspending
 ...
 I: client.c: Created 0 "Native client (UNIX socket client)"
 I: protocol-native.c: Got credentials: uid=1000 gid=1001 success=1
 I: client.c: Freed 0 "Видеопроигрыватель Totem"
 I: protocol-native.c: Connection died.
 I: client.c: Created 1 "Native client (UNIX socket client)"
 I: protocol-native.c: Got credentials: uid=1000 gid=1001 success=1
 I: module-volume-restore.c: Restoring sink for <pulsecore/protocol-
 native.c$rhythmbox>
 I: module-volume-restore.c: Restoring volume for <pulsecore/protocol-
 native.c$rhythmbox>
 I: resampler.c: Using resampler 'speex-float-3'
 I: resampler.c: Using float32le as working format.
 I: resampler.c: Choosing speex quality setting 3.
 I: sink-input.c: Created input 0 "Playback Stream" on headphones with
 sample spec s16le 2ch 44100Hz and channel map front-left,front-right
 I: protocol-native.c: Requested tlength=200,00 ms, minreq=10,00 ms
 I: protocol-native.c: Final latency 380,00 ms = 180,00 ms + 2*10,00 ms +
 180,00 ms


 **** alsa_pcm: xrun of at least 42.607 msecs




 **** alsa_pcm: xrun of at least 9.460 msecs


 I: sink-input.c: Freeing input 0 "Playback Stream"
 I: client.c: Freed 1 "rhythmbox"
 I: protocol-native.c: Connection died.
 I: client.c: Created 2 "Native client (UNIX socket client)"
 I: module-suspend-on-idle.c: Sink headphones idle for too long, suspending
 ...
 I: protocol-native.c: Got credentials: uid=1000 gid=1001 success=1
 I: module-volume-restore.c: Restoring sink for <pulsecore/protocol-
 native.c$rhythmbox>
 I: module-volume-restore.c: Restoring volume for <pulsecore/protocol-
 native.c$rhythmbox>
 I: resampler.c: Using resampler 'speex-float-3'
 I: resampler.c: Using float32le as working format.
 I: resampler.c: Choosing speex quality setting 3.
 I: sink-input.c: Created input 1 "Playback Stream" on headphones with
 sample spec s16le 2ch 44100Hz and channel map front-left,front-right
 I: protocol-native.c: Requested tlength=200,00 ms, minreq=10,00 ms
 I: protocol-native.c: Final latency 380,00 ms = 180,00 ms + 2*10,00 ms +
 180,00 ms


 **** alsa_pcm: xrun of at least 51.127 msecs




 **** alsa_pcm: xrun of at least 9.600 msecs


 I: client.c: Created 3 "Native client (UNIX socket client)"
 I: sink-input.c: Freeing input 1 "Playback Stream"
 I: client.c: Freed 2 "rhythmbox"
 I: protocol-native.c: Connection died.
 I: module-suspend-on-idle.c: Sink headphones idle for too long, suspending
 ...
 I: protocol-native.c: Got credentials: uid=1000 gid=1001 success=1
 I: module-volume-restore.c: Restoring sink for <pulsecore/protocol-
 native.c$rhythmbox>
 I: module-volume-restore.c: Restoring volume for <pulsecore/protocol-
 native.c$rhythmbox>
 I: resampler.c: Using resampler 'speex-float-3'
 I: resampler.c: Using float32le as working format.
 I: resampler.c: Choosing speex quality setting 3.
 I: sink-input.c: Created input 2 "Playback Stream" on headphones with
 sample spec s16le 2ch 44100Hz and channel map front-left,front-right
 I: protocol-native.c: Requested tlength=200,00 ms, minreq=10,00 ms
 I: protocol-native.c: Final latency 380,00 ms = 180,00 ms + 2*10,00 ms +
 180,00 ms


 **** alsa_pcm: xrun of at least 54.413 msecs




 **** alsa_pcm: xrun of at least 10.398 msecs


 I: client.c: Created 4 "Native client (UNIX socket client)"
 I: sink-input.c: Freeing input 2 "Playback Stream"
 I: client.c: Freed 3 "rhythmbox"
 I: protocol-native.c: Connection died.
 I: module-suspend-on-idle.c: Sink headphones idle for too long, suspending
 ...
 I: protocol-native.c: Got credentials: uid=1000 gid=1001 success=1
 I: module-volume-restore.c: Restoring sink for <pulsecore/protocol-
 native.c$rhythmbox>
 I: module-volume-restore.c: Restoring volume for <pulsecore/protocol-
 native.c$rhythmbox>
 I: resampler.c: Using resampler 'speex-float-3'
 I: resampler.c: Using float32le as working format.
 I: resampler.c: Choosing speex quality setting 3.
 I: sink-input.c: Created input 3 "Playback Stream" on headphones with
 sample spec s16le 2ch 44100Hz and channel map front-left,front-right
 I: protocol-native.c: Requested tlength=200,00 ms, minreq=10,00 ms
 I: protocol-native.c: Final latency 380,00 ms = 180,00 ms + 2*10,00 ms +
 180,00 ms


 **** alsa_pcm: xrun of at least 50.456 msecs




 **** alsa_pcm: xrun of at least 11.080 msecs

 I: client.c: Created 5 "Native client (UNIX socket client)"

 I: protocol-native.c: Got credentials: uid=1000 gid=1001 success=1
 I: sink-input.c: Freeing input 3 "Playback Stream"
 I: client.c: Freed 4 "rhythmbox"
 I: protocol-native.c: Connection died.
 I: module-suspend-on-idle.c: Sink headphones idle for too long, suspending
 ...
 I: module-volume-restore.c: Restoring sink for <pulsecore/protocol-
 native.c$rhythmbox>
 I: module-volume-restore.c: Restoring volume for <pulsecore/protocol-
 native.c$rhythmbox>
 I: resampler.c: Using resampler 'speex-float-3'
 I: resampler.c: Using float32le as working format.
 I: resampler.c: Choosing speex quality setting 3.
 I: sink-input.c: Created input 4 "Playback Stream" on headphones with
 sample spec s16le 2ch 44100Hz and channel map front-left,front-right
 I: protocol-native.c: Requested tlength=200,00 ms, minreq=10,00 ms
 I: protocol-native.c: Final latency 380,00 ms = 180,00 ms + 2*10,00 ms +
 180,00 ms


 **** alsa_pcm: xrun of at least 48.742 msecs

 }}}

-- 
Ticket URL: <http://pulseaudio.org/ticket/500>
PulseAudio <http://pulseaudio.org/>
The PulseAudio Sound Server
_______________________________________________
pulseaudio-tickets mailing list
pulseaudio-tickets@mail.0pointer.de
https://tango.0pointer.de/mailman/listinfo/pulseaudio-tickets

Reply via email to