[pulseaudio-discuss] sound is distorted when pulseaudio system timer scheduling is used (tsched=1)

Jiada Wang jiada_wang at mentor.com
Fri Aug 28 02:16:08 PDT 2015


Hello Community

I am having issue with pulseaudiosink,
I used following command to play a wav file
gst-launch filesrc location=<wav file path> ! wavparse ! pulseaudiosink

if tsched is enabled, then play of wav file via pulseaudiosink gives me 
lots of Underrun, and the sound is distorted, following is the 
pulseaudio log when --log-level=3

I: [pulseaudio] protocol-native.c: Got credentials: uid=0 gid=0 success=1
I: [pulseaudio] sink-input.c: Trying to change sample rate
I: [pulseaudio] alsa-sink.c: Updating rate for device hw:0, new rate is 
48000
I: [pulseaudio] source.c: Changed sampling rate successfully
I: [pulseaudio] sink.c: Changed sampling rate successfully
I: [pulseaudio] sink-input.c: Rate changed to 48000 Hz
I: [alsa-sink-HiFi wm8962-0] alsa-sink.c: Trying resume...
I: [alsa-sink-HiFi wm8962-0] alsa-util.c: cannot disable ALSA period wakeups
I: [alsa-sink-HiFi wm8962-0] alsa-util.c: ALSA period wakeups were not 
disabled
I: [alsa-sink-HiFi wm8962-0] alsa-sink.c: Time scheduling watermark is 
18.38ms
I: [alsa-sink-HiFi wm8962-0] alsa-sink.c: Resumed successfully...
I: [alsa-sink-HiFi wm8962-0] alsa-sink.c: Starting playback.
I: [pulseaudio] sink-input.c: Created input 0 "pulsesink probe" on 
alsa_output.platform-sound.analog-s
tereo with sample spec s16le 2ch 48000Hz and channel map 
front-left,front-right
I: [pulseaudio] sink-input.c:     media.name = "pulsesink probe"
I: [pulseaudio] sink-input.c:     application.name = "gst-launch-0.10"
I: [pulseaudio] sink-input.c:     native-protocol.peer = "UNIX socket 
client"
I: [pulseaudio] sink-input.c:     native-protocol.version = "29"
I: [pulseaudio] sink-input.c:     application.process.id = "985"
I: [pulseaudio] sink-input.c:     application.process.user = "root"
I: [pulseaudio] sink-input.c:     application.process.host = "mx6q"
I: [pulseaudio] sink-input.c:     application.process.binary = 
"gst-launch-0.10"
I: [pulseaudio] sink-input.c:     application.language = "C"
I: [pulseaudio] sink-input.c:     application.process.machine_id = 
"0aa7a9566c734f608cbd36f187de8645"
I: [pulseaudio] sink-input.c:     module-stream-restore.id = 
"sink-input-by-application-name:gst-launc
h-0.10"
I: [pulseaudio] protocol-native.c: Requested tlength=250.00 ms, 
minreq=20.00 ms
I: [pulseaudio] protocol-native.c: Final latency 250.00 ms = 105.00 ms + 
2*20.00 ms + 105.00 ms
I: [pulseaudio] sink-input.c: Freeing input 0 "pulsesink probe"
I: [pulseaudio] sink-input.c: Created input 1 "Playback Stream" on 
alsa_output.platform-sound.analog-s
tereo with sample spec s16le 2ch 48000Hz and channel map 
front-left,front-right
I: [pulseaudio] sink-input.c:     media.name = "Playback Stream"
I: [pulseaudio] sink-input.c:     application.name = "gst-launch-0.10"
I: [pulseaudio] sink-input.c:     native-protocol.peer = "UNIX socket 
client"
I: [pulseaudio] sink-input.c:     native-protocol.version = "29"
I: [pulseaudio] sink-input.c:     application.process.id = "985"
I: [pulseaudio] sink-input.c:     application.process.user = "root"
I: [pulseaudio] sink-input.c:     application.process.host = "mx6q"
I: [pulseaudio] sink-input.c:     application.process.binary = 
"gst-launch-0.10"
I: [pulseaudio] sink-input.c:     application.language = "C"
I: [pulseaudio] sink-input.c:     application.process.machine_id = 
"0aa7a9566c734f608cbd36f187de8645"
I: [pulseaudio] sink-input.c:     module-stream-restore.id = 
"sink-input-by-application-name:gst-launc
h-0.10"
I: [pulseaudio] protocol-native.c: Requested tlength=200.00 ms, 
minreq=10.00 ms
I: [pulseaudio] protocol-native.c: Final latency 200.00 ms = 90.00 ms + 
2*10.00 ms + 90.00 ms
I: [alsa-sink-HiFi wm8962-0] alsa-sink.c: Increasing wakeup watermark to 
28.38 ms
I: [alsa-sink-HiFi wm8962-0] alsa-sink.c: Increasing wakeup watermark to 
38.38 ms
I: [alsa-sink-HiFi wm8962-0] alsa-sink.c: Increasing wakeup watermark to 
48.38 ms
I: [alsa-sink-HiFi wm8962-0] alsa-sink.c: Increasing wakeup watermark to 
58.38 ms
I: [alsa-sink-HiFi wm8962-0] alsa-sink.c: Increasing wakeup watermark to 
68.38 ms
I: [alsa-sink-HiFi wm8962-0] alsa-sink.c: Increasing wakeup watermark to 
78.38 ms
I: [alsa-sink-HiFi wm8962-0] alsa-sink.c: Increasing wakeup watermark to 
80.00 ms
I: [alsa-sink-HiFi wm8962-0] alsa-sink.c: Increasing minimal latency to 
1.00 ms
I: [alsa-sink-HiFi wm8962-0] alsa-sink.c: Increasing minimal latency to 
2.00 ms
I: [alsa-sink-HiFi wm8962-0] alsa-sink.c: Increasing minimal latency to 
4.00 ms
I: [alsa-sink-HiFi wm8962-0] alsa-sink.c: Increasing minimal latency to 
8.00 ms
I: [alsa-sink-HiFi wm8962-0] alsa-sink.c: Increasing minimal latency to 
16.00 ms
I: [alsa-sink-HiFi wm8962-0] alsa-sink.c: Increasing minimal latency to 
26.00 ms
I: [alsa-sink-HiFi wm8962-0] alsa-sink.c: Increasing minimal latency to 
36.00 ms
I: [alsa-sink-HiFi wm8962-0] alsa-sink.c: Increasing minimal latency to 
46.00 ms
E: [alsa-sink-HiFi wm8962-0] alsa-sink.c: ALSA woke us up to write new 
data to the device, but there w
as actually nothing to write!
E: [alsa-sink-HiFi wm8962-0] alsa-sink.c: Most likely this is a bug in 
the ALSA driver '(null)'. Pleas
e report this issue to the ALSA developers.
E: [alsa-sink-HiFi wm8962-0] alsa-sink.c: We were woken up with POLLOUT 
set -- however a subsequent sn
d_pcm_avail() returned 0 or another value < min_avail.
I: [alsa-sink-HiFi wm8962-0] alsa-sink.c: Increasing minimal latency to 
56.00 ms
I: [alsa-sink-HiFi wm8962-0] alsa-sink.c: Increasing minimal latency to 
66.00 ms
I: [alsa-sink-HiFi wm8962-0] alsa-sink.c: Increasing minimal latency to 
76.00 ms
I: [alsa-sink-HiFi wm8962-0] alsa-sink.c: Increasing minimal latency to 
86.00 ms
I: [alsa-sink-HiFi wm8962-0] alsa-sink.c: Increasing minimal latency to 
96.00 ms
I: [alsa-sink-HiFi wm8962-0] alsa-sink.c: Increasing wakeup watermark to 
86.00 ms
I: [alsa-sink-HiFi wm8962-0] alsa-sink.c: Increasing minimal latency to 
106.00 ms
I: [alsa-sink-HiFi wm8962-0] alsa-sink.c: Increasing wakeup watermark to 
96.00 ms
I: [alsa-sink-HiFi wm8962-0] alsa-sink.c: Increasing minimal latency to 
116.00 ms
I: [alsa-sink-HiFi wm8962-0] alsa-sink.c: Increasing wakeup watermark to 
106.00 ms
I: [alsa-sink-HiFi wm8962-0] alsa-sink.c: Increasing minimal latency to 
126.00 ms
I: [alsa-sink-HiFi wm8962-0] alsa-sink.c: Increasing wakeup watermark to 
116.00 ms
I: [alsa-sink-HiFi wm8962-0] alsa-sink.c: Increasing minimal latency to 
136.00 ms
I: [alsa-sink-HiFi wm8962-0] alsa-sink.c: Increasing wakeup watermark to 
126.00 ms
I: [alsa-sink-HiFi wm8962-0] alsa-sink.c: Underrun!
I: [alsa-sink-HiFi wm8962-0] alsa-sink.c: Increasing minimal latency to 
146.00 ms
I: [alsa-sink-HiFi wm8962-0] alsa-sink.c: Underrun!
I: [alsa-sink-HiFi wm8962-0] alsa-sink.c: Increasing wakeup watermark to 
136.00 ms
I: [alsa-sink-HiFi wm8962-0] alsa-sink.c: Underrun!
I: [alsa-sink-HiFi wm8962-0] alsa-sink.c: Increasing minimal latency to 
156.00 ms
I: [alsa-sink-HiFi wm8962-0] alsa-sink.c: Increasing wakeup watermark to 
146.00 ms
I: [alsa-sink-HiFi wm8962-0] alsa-sink.c: Increasing minimal latency to 
166.00 ms
I: [alsa-sink-HiFi wm8962-0] alsa-sink.c: Increasing wakeup watermark to 
156.00 ms
I: [alsa-sink-HiFi wm8962-0] alsa-sink.c: Increasing minimal latency to 
176.00 ms
I: [pulseaudio] sink-input.c: Freeing input 1 "Playback Stream"
I: [pulseaudio] client.c: Freed 4 "gst-launch-0.10"
I: [pulseaudio] protocol-native.c: Connection died.

from the log it seems like, when system timer based scheduling is used, 
then pulseaudio will try to keep minimum watermark/latency, only when 
Underrun occurs, it will increase watermark/latency.

Is this the expected behaviour of pulseaudio 'glict free' feature?

And from the log there is some error message complain about ALSA driver
E: [alsa-sink-HiFi wm8962-0] alsa-sink.c: ALSA woke us up to write new 
data to the device, but there w
as actually nothing to write!
E: [alsa-sink-HiFi wm8962-0] alsa-sink.c: Most likely this is a bug in 
the ALSA driver '(null)'. Pleas
e report this issue to the ALSA developers.
E: [alsa-sink-HiFi wm8962-0] alsa-sink.c: We were woken up with POLLOUT 
set -- however a subsequent sn
d_pcm_avail() returned 0 or another value < min_avail.

does this mean, there is some bug in ALSA driver, or it just indicates 
the ALSA driver doesn't support glitch free feature very well

If play the same wav file again before device enter suspend status, then 
  the result was good, following is the log


I: [pulseaudio] protocol-native.c: Got credentials: uid=0 gid=0 success=1
I: [pulseaudio] sink-input.c: Created input 4 "pulsesink probe" on 
alsa_output.platform-sound.analog-s
tereo with sample spec s16le 2ch 48000Hz and channel map 
front-left,front-right
I: [pulseaudio] sink-input.c:     media.name = "pulsesink probe"
I: [pulseaudio] sink-input.c:     application.name = "gst-launch-0.10"
I: [pulseaudio] sink-input.c:     native-protocol.peer = "UNIX socket 
client"
I: [pulseaudio] sink-input.c:     native-protocol.version = "29"
I: [pulseaudio] sink-input.c:     application.process.id = "688"
I: [pulseaudio] sink-input.c:     application.process.user = "root"
I: [pulseaudio] sink-input.c:     application.process.host = "mx6q"
I: [pulseaudio] sink-input.c:     application.process.binary = 
"gst-launch-0.10"
I: [pulseaudio] sink-input.c:     application.language = "C"
I: [pulseaudio] sink-input.c:     application.process.machine_id = 
"0aa7a9566c734f608cbd36f187de8645"
I: [pulseaudio] sink-input.c:     module-stream-restore.id = 
"sink-input-by-application-name:gst-launc
h-0.10"
I: [pulseaudio] protocol-native.c: Requested tlength=250.00 ms, 
minreq=20.00 ms
I: [pulseaudio] protocol-native.c: Final latency 392.00 ms = 176.00 ms + 
2*20.00 ms + 176.00 ms
I: [pulseaudio] sink-input.c: Freeing input 4 "pulsesink probe"
I: [pulseaudio] sink-input.c: Created input 5 "Playback Stream" on 
alsa_output.platform-sound.analog-s
tereo with sample spec s16le 2ch 48000Hz and channel map 
front-left,front-right
I: [pulseaudio] sink-input.c:     media.name = "Playback Stream"
I: [pulseaudio] sink-input.c:     application.name = "gst-launch-0.10"
I: [pulseaudio] sink-input.c:     native-protocol.peer = "UNIX socket 
client"
I: [pulseaudio] sink-input.c:     native-protocol.version = "29"
I: [pulseaudio] sink-input.c:     application.process.id = "688"
I: [pulseaudio] sink-input.c:     application.process.user = "root"
I: [pulseaudio] sink-input.c:     application.process.host = "mx6q"
I: [pulseaudio] sink-input.c:     application.process.binary = 
"gst-launch-0.10"
I: [pulseaudio] sink-input.c:     application.language = "C"
I: [pulseaudio] sink-input.c:     application.process.machine_id = 
"0aa7a9566c734f608cbd36f187de8645"
I: [pulseaudio] sink-input.c:     module-stream-restore.id = 
"sink-input-by-application-name:gst-launc
h-0.10"
I: [pulseaudio] protocol-native.c: Requested tlength=200.00 ms, 
minreq=10.00 ms
I: [pulseaudio] protocol-native.c: Final latency 372.00 ms = 176.00 ms + 
2*10.00 ms + 176.00 ms
I: [pulseaudio] sink-input.c: Freeing input 5 "Playback Stream"
I: [pulseaudio] client.c: Freed 6 "gst-launch-0.10"
I: [pulseaudio] protocol-native.c: Connection died.
I: [pulseaudio] module-suspend-on-idle.c: Sink 
alsa_output.platform-sound.analog-stereo idle for too l
ong, suspending ...
I: [alsa-sink-HiFi wm8962-0] alsa-sink.c: Device suspended...

If set tsched=0 to use interrupt based scheduling, then I got good sound

Thanks,
Jiada


More information about the pulseaudio-discuss mailing list