[pulseaudio-discuss] Bluetooth (a2dpd) output stutters

Jim Carter jimc at math.ucla.edu
Tue Sep 25 22:15:45 PDT 2007


Time to point the finger of blame, but at who?   I have PulseAudio set
up pretty much according to the various readme files and sample configs.
It starts out with just one sink:
    load-module module-alsa-sink sink_name=speaker device=hw:0
Properly configured players can play on the internal speaker. 
Player command lines tested today were:
    paplay file.wav
    xmms file.ogg (with PulseAudio output plugin selected)

In parallel with this, a2dpd from bluetooth-alsa CVS 
is installed and running, and .asoundrc sets this as the default ALSA 
device (because some players' configuration dialogs lack a device 
override).  In addition to Xine and GStreamer based players, these 
were tested just now and played the content on the Bluetooth headphones:
    aplay -D a2dpd file.wav
    ogg123 file.ogg
    xmms file.ogg (with ALSA output plugin set for a2dpd)

At the moment .asoundrc includes a software volume control as suggested
in the a2dpd sources, which works with all of the above, but similar
results are obtained without it, using the players' internal software
volume control when available (or no volume control possible, otherwise).

Returning to pulseaudio: during or before playback on the internal 
speaker, I do:
    load-module module-alsa-sink sink_name=a2dpd device=a2dpd
It sends to syslog:
    pulseaudio[7655]: alsa-util.c: Unable to attach to mixer a2dpd: No 
	such file or directory
Note, I just loaded the module; I didn't move-sink-input yet.

The sound stream then stutters.  3 or 4 times per second [of original
music] a fraction of a second of silence is inserted.  
    . Playback proceeds at 50% down to 20% of the proper speed (varies).
    . No music is lost; it picks up where it was interrupted.
    . When music is playing it is at its proper pitch.  
    . I can't distinguish between sending ALSA buffer loads of all zero, 
	or not sending anything.  
    . pulseaudio -v does not log any more error messages than the above.
    . If I move-sink-input to the a2dpd sink, the stuttering stream is
	played on the Bluetooth headphones.
    . CPU utilization ranges from 0.2% to 0.5% (idle is 99.5% to 99.8%).
	This is on an Intel Core 2 Duo at 1.83 GHZ.  "Top" never catches
	a2dpd or pulseaudio in run state, and xmms only very rarely.

Needless to say, this makes for a less than optimal listening experience.

EsounD does not have the stuttering problem; that is, the issue is not
generic in sound proxies.  Besides previous tests of several Xine and
GStreamer players, I tested just now:
    esdplay file.wav
    xmms file.ogg (with EsounD plugin)

Versions:
    PulseAudio-0.9.6
    bluez-utils-3.7, supplemented by:
    bluetooth-alsa CVS of 2007-09-19 
	( http://bluetooth-alsa.sourceforge.net/build.html )
    alsa-1.0.13
    xmms-1.2.10
    Distro: OpenSuSE 10.2
    Kernel: 2.6.18.8

Configuration files:

/usr/local/etc/pulse/client.conf
    From sources -- everything commented out, no jimc hacks.

/usr/local/etc/pulse/daemon.conf (only uncommented items shown)
    verbose = 1
    daemonize = 1
    high-priority = 1
    default-script-file = /usr/local/etc/pulse/default.pa

/usr/local/etc/pulse/default.pa

#!/usr/local/bin/pulseaudio -nF 
# Set up for Xena by jimc, 2007-07-28
# Hints from sample conf file in 
# http://wm161.net/2007/06/24/how-pulseaudio-made-my-openhouse-awesome/

### Load protocols
load-module module-esound-protocol-unix
load-module module-native-protocol-unix

### Automatically restore the volume of playback streams
load-module module-volume-restore

### Automatically move streams to the default sink if the sink they are
### connected to dies, similar for sources
load-module module-rescue-streams

# Preload modules using human-friendly names.
load-module module-alsa-sink sink_name=speaker device=hw:0
load-module module-alsa-source source_name=capture device=hw:0
#commented out: load-module module-alsa-sink sink_name=a2dpd device=a2dpd

### Detect hardware on the machine, pick 1 or none
#load-module module-hal-detect
#load-module module-detect

### Make some devices default
set-default-sink speaker
set-default-source capture

### Load audio drivers automatically on access
add-autoload-sink output module-alsa-sink sink_name=a2dpd device=a2dpd
add-autoload-sink output module-oss device="/dev/dsp" sink_name=ossout source_name=ossin
add-autoload-source input module-oss device="/dev/dsp" sink_name=ossout source_name=ossin

.nofail

### Load something to the sample cache
load-sample x11-bell /opt/gnome/share/sounds/gtk-events/toggled.wav

### Load X11 bell module
load-module module-x11-bell sample=x11-bell

### Publish connection data in the X11 root window
load-module module-x11-publish


~/.asoundrc

# Alsa sound configuration, used with arecord and aplay.
# Set up manually by jimc, 2004-08-25
# 2007-03-15	Add Bluetooth devices
# 2007-09-25	Try again to make the software volume control work

# The internal audio bus (I think), used for sound output
pcm.line {
	type	hw
	card	0
	device	0
}

# The microphone ADC
pcm.mic {
	type	hw
	card	0
	device	1
}

# Bluetooth A2DP and SCO device and corresponding mixer
# A2DP is stereo output at 44100 Hz; SCO is mono input-output at 8000 Hz.
pcm.a2dpd {
	type	plug
	slave.pcm	"a2dpdsoftvol"
}
pcm.a2dpdsoftvol {
	type	softvol
	slave {
		pcm "a2dpdplug"
	}
	control {
		name "Bluetooth Headset"
		card	0
		count	1
	}
}
pcm.a2dpdplug {
	type a2dpd
}
# The library that implements ctl.a2dpd is no longer built, as of CVS 2007-08-04



# For the HSP/HFP telephony headset
pcm.sco {
	type	sco
#	device	00:07:a4:f1:c8:e9
}
ctl.sco {
	type	sco
}

pcm.default pcm.a2dpd




More information about the pulseaudio-discuss mailing list