severe underruns with usb audio, works with pa 3.0 - buffer setup seems wrong
Submitted by David Mansfield
Assigned to pul..@..op.org
Description
Created attachment 109436 log of running with PA 3.0 version from Centos 7
Description of problem: Constant and severe audio underruns when using Jitsi (voip softphone). When using the pulseaudio 3.0 version from Centos 7 (rhel) audio is perfectly smooth.
Version-Release number of selected component (if applicable): pulseaudio-5.0-7.fc20.x86_64
How reproducible: 100%
Steps to Reproduce:
- install jitsi, set up a sip account, use USB audio headset (e.g. plantronics)
- make a call
- audio (playback) is choppy and jitsi reports "discarded packets"
Actual results: choppy audio, tons of underruns reported by PA
Expected results: smooth audio
Additional info: Installing the pulseaudio rpms from centos 7 "cures" the problem.
I have run PA in debug mode and captured the log from the startup of PA through hanging up the call both with the 3.0 PA version (current C7) and 5.0 PA version (current F20).
I'll attach the logs.
Diffing the two logs (old (-) = 3.0, new (+) = 5.0), it looks like the significant difference in tho logs has to do with buffering setup (as expected):
I: [pulseaudio] card.c: Created 1 "alsa_card.usb-Plantronics_Plantronics_.Audio_648_USB-00-USB" +I: [pulseaudio] module-card-restore.c: Storing profile and port latency offsets for card alsa_card.usb-Plantronics_Plantronics_.Audio_648_USB-00-USB. +D: [pulseaudio] module-alsa-card.c: Found 0 jacks. D: [pulseaudio] reserve-wrap.c: Successfully create reservation lock monitor for device 'Audio3' D: [pulseaudio] alsa-util.c: Trying front:3 with SND_PCM_NO_AUTO_FORMAT ... D: [pulseaudio] alsa-util.c: Managed to open front:3 -I: [pulseaudio] alsa-util.c: cannot disable ALSA period wakeups +I: [pulseaudio] alsa-util.c: Disabling tsched mode since BATCH flag is set D: [pulseaudio] alsa-util.c: Maximum hw buffer size is 5944 ms -D: [pulseaudio] alsa-util.c: Set buffer size first (to 88200 samples), period size second (to 88200 samples). -I: [pulseaudio] alsa-util.c: ALSA period wakeups were not disabled +D: [pulseaudio] alsa-util.c: Set buffer size first (to 4408 samples), period size second (to 1102 samples). I: [pulseaudio] alsa-sink.c: Successfully opened device front:3. I: [pulseaudio] alsa-sink.c: Selected mapping 'Analog Stereo' (analog-stereo). +I: [pulseaudio] alsa-sink.c: Cannot enable timer-based scheduling, falling back to sound IRQ scheduling. I: [pulseaudio] alsa-sink.c: Successfully enabled mmap() mode. -I: [pulseaudio] alsa-sink.c: Successfully enabled timer-based scheduling mode. I: [pulseaudio] (alsa-lib)control.c: Invalid CTL front:3 I: [pulseaudio] alsa-util.c: Unable to attach to mixer front:3: No such file or directory I: [pulseaudio] alsa-util.c: Successfully attached to mixer 'hw:3' @@ -1055,9 +1173,9 @@ I: [pulseaudio] sink.c: device.product.name = "Plantronics .Audio 648 USB" I: [pulseaudio] sink.c: device.serial = "Plantronics_Plantronics_.Audio_648_USB" I: [pulseaudio] sink.c: device.string = "front:3" -I: [pulseaudio] sink.c: device.buffering.buffer_size = "352800" -I: [pulseaudio] sink.c: device.buffering.fragment_size = "176400" -I: [pulseaudio] sink.c: device.access_mode = "mmap+timer" +I: [pulseaudio] sink.c: device.buffering.buffer_size = "17632" +I: [pulseaudio] sink.c: device.buffering.fragment_size = "4408" +I: [pulseaudio] sink.c: device.access_mode = "mmap" I: [pulseaudio] sink.c: device.profile.name = "analog-stereo" I: [pulseaudio] sink.c: device.profile.description = "Analog Stereo" I: [pulseaudio] sink.c: device.description = "Plantronics .Audio 648 USB Analog Stereo" @@ -1085,16 +1203,16 @@ I: [pulseaudio] source.c: device.string = "3" I: [pulseaudio] source.c: module-udev-detect.discovered = "1" I: [pulseaudio] source.c: device.icon_name = "audio-card-usb" -I: [pulseaudio] alsa-sink.c: Using 2.0 fragments of size 176400 bytes (1000.00ms), buffer size is 352800 bytes (2000.00ms) -I: [pulseaudio] alsa-sink.c: Time scheduling watermark is 20.00ms +I: [pulseaudio] alsa-sink.c: Using 4.0 fragments of size 4408 bytes (24.99ms), buffer size is 17632 bytes (99.95ms) D: [pulseaudio] alsa-sink.c: hwbuf_unused=0 -D: [pulseaudio] alsa-sink.c: setting avail_min=87319 +D: [pulseaudio] alsa-sink.c: setting avail_min=1
Also, theres this difference in realtime prio:
-D: [alsa-sink] alsa-sink.c: Thread starting up -I: [alsa-sink] core-util.c: Failed to acquire real-time scheduling: Permission denied -I: [alsa-sink] alsa-sink.c: Starting playback. -D: [alsa-sink] alsa-sink.c: Cutting sleep time for the initial iterations by half. -D: [alsa-sink] alsa-sink.c: Cutting sleep time for the initial iterations by half. +D: [pulseaudio] alsa-sink.c: Read hardware volume: front-left: 34131 / 52% / -17.00 dB, front-right: 34131 / 52% / -17.00 dB +D: [alsa-sink-USB Audio] alsa-sink.c: Thread starting up +D: [alsa-sink-USB Audio] core-util.c: RealtimeKit worked. +I: [alsa-sink-USB Audio] core-util.c: Successfully enabled SCHED_RR scheduling for thread, with priority 5. +I: [alsa-sink-USB Audio] alsa-sink.c: Starting playback.
Attachment 109436, "log of running with PA 3.0 version from Centos 7":
palog.pa-3.0.txt