On July 23 Marcel Holtmann delivered a presentation on the state of
Audio Streaming over Bluetooth
at the 2008 Linux Symposium in Ottawa.
Holtmann's background involves working on improving Linux Bluetooth
audio support for laptops and embedded systems such as cell phones.
Marcel expressed frustration with the complexity of the Bluetooth specifications
which include approximately 20 protocols and 40 profiles. Profiles include things like
mono headsets, in-car usage and high quality stereo headphones. There are protocols
for serial device emulation, phone book access, caller ID information, text messaging and
multiple options for audio and video.
Bluetooth defines separate protocols for streaming and control, such as skipping tracks,
seeking within tracks, and displaying
information. Having these aspects split into different
protocols was called "messy" because they are always used together.
Mono headsets are supported by the Synchronous Connection Oriented link (SCO), while
the Advanced Audio Distribution Profile (A2DP) is designed for high quality stereo audio.
For audio compression Bluetooth defines a royalty-free SubBand-Codec (SBC) to avoid
fees for use of common codecs like MP3 and AAC. All A2DP devices must support
SBC, but many also support decoding MP3 and AAC as well.
Linux's SBC support was initially very poor, but some developers from the Instituto Nokia de Tecnologia in Brazil stepped up to improve encoding and now the the LGPL SBC
implementation rivals some of the
best commercial implementations.
Early Bluetooth headset support in Linux involved copying all the audio data over
sockets from the application to the Bluetooth daemon. The daemon would then copy the
data again to the device, causing unnecessary CPU usage and increasing latency. The current
design works by setting up channels and connecting external applications directly
to the device sockets. Marcel also mentioned investigating
a shared memory approach for better performance at the cost of some extra complexity.
Adding support for a Bluetooth audio device is
quite different than for standard audio hardware — compressed data must be sent directly to the
devices, possibly with ID3 and other information. If the audio being played is in a format
that a device does not support it must be decoded and re-encoded first. Bluetooth devices will also
appear and disappear while audio is being played.
"I won't touch it anymore." ALSA's primary failing is that it wasn't designed
to support virtual devices.
He is also not convinced that the current direction of PulseAudio is suitable for
Bluetooth audio, in particular there is no support for
changing codecs while audio is being sent to a device.
however can support the concept of virtual devices, sending
out encoded data and sending ID3 information when required.
If a file format is supported by a Bluetooth device,
GStreamer can easily be told to send it as-is without re-encoding it.
It can also handle the passing off of the encoding and decoding tasks
to special hardware, which is commonly required for embedded systems.
Future work includes adding more intelligence to the handling of
When the user presses Pause and there are multiple devices and streams
active, which stream should be affected?
The current implementation applies the action to all streams,
but it may be better to be able to tell which control device is
associated with which stream.
There is also ongoing work to support new hardware.
Marcel has had some issues with headsets that are very sensitive
to timing, but don't provide enough timing information to reliably
fix. There have also been some problems supporting
"Enhanced" Synchronous Connection-oriented (eSCO) Links
due to vendors that are unwilling to cooperate with the developers.
For more information on Bluetooth development see Marcel's OLS Paper [pdf] and
BlueZ.org, the site for the
official Linux Bluetooth protocol stack.
to post comments)