GSoC 2008

This year I’ve participated in the Google Summer of Code program. Despite the fact that wasn’t summer in the southern hemisphere, everything happened as expected. I’ve worked with BlueZ as my mentoring organization, and my project was to add bluetooth support to the PulseAudio sound server. The abstract of my application can be found here.

The implementation was made through 2 modules: module-bluetooth-device and module-bluetooth-discover. The latter connects to BlueZ through D-Bus to find out what devices have already been paired with each adapter present on the system, and the loads one instance of the module-bluetooth-device for each device found (in contrast to linux kernel modules, PulseAudio modules can be loaded more than once at the same time). It also keeps watching for new adapters and devices, so it can load a module to take care of each new device that shows up.

The former, module-bluetooth-device, is the one who actually does the job of creating the bluetooth audio channel in PulseAudio. First, it connects to the BlueZ audio service through one unix socket to obtain the device capabilities. Then it configures the device according to it’s capabilities, setup the SBC encoder (if applicable) and obtain a file descriptor to write audio data to the device. This fd is passed to a PulseAudio I/O thread (which runs with real time priorities if the user has real time privileges properly set), which gets the audio data coming to this sink (sink is the name of an output channel in PulseAudio), encode it (if applicable) and write it on the device fd. Also, the I/O thread has to take care of the clock synchronization between PulseAudio an the device.

I really enjoyed doing this job. Working with an open source community is outstanding! I’ve learned a lot during the program, made good contacts, and the most important: had a lot of fun! I would like to thank a lot my mentor, Luiz Augusto von Dentz, and the PulseAudio maintainer, Lennart Poettering. Without the help of these two guys I wouldn’t have been able to finish this project. And of course I have to thank Google for helping FLOSS develpment throug this program and LH for making the program happen and for being so kind and patient with all the students. LH, you rock!

I’ll continue working on this project, since there still a lot to be done. Time synchronization is not the best and the usability is far from ideal. I have a git repository for this on gitorious, on an branch called bt. Feel free to point bugs and make sugestions. Also, if you really enjoyed the project and want to help more, I accept donations of A2DP, HSP, or HFP bluetooth audio devices, for test and development. All of this was made so far with a borrowed device from my good friend João Eduardo Ferreira Bertacchi (thanks JE!). The oficial release note on the BlueZ website about this project can be found here.

About these ads

4 responses to “GSoC 2008

  1. Definitely hope to see this in some major distros soon. :)
    I’m not the best at it, but poke me if you need some packaging help in Ubuntu.
    People need to see this module.

  2. The bluetooth modules just went upstream on PulseAudio, so the best would be to package PulseAudio 0.9.13. AFAIK Intrepid has all the dependencies required. Feel free to package it if you want, the list of dependencies can be found here: http://pulseaudio.org/wiki/DownloadPulseAudio

    I don’t know which version of PulseAudio Intrepid will ship, but would be nice if it shipped 0.9.13!

  3. I backported the jaunty pulseaudio package (0.9.13) to intrepid and uploaded to my PPA. Try adding the following to your apt sources, then upgrade.

    deb http://ppa.launchpad.net/racb/ubuntu intrepid main
    deb-src http://ppa.launchpad.net/racb/ubuntu intrepid main

    HOWEVER, bluetooth on Intrepid appears broken. I think it’s a bug in bluez: https://bugs.launchpad.net/ubuntu/+source/bluez/+bug/306721

    So Ubuntu Intrepid isn’t going to work with bluetooth audio through pulseaudio until this is fixed :-(

  4. Hey, I wanted to leave this post after I have gotten Pulse audio to work with ALSA and a2dp V 0.9.15 in Jaunty with blueman. The integration seems so seemless that I dont really think any one could have done it better…. The Intuitive UI’s the simple stream switching, real time playback, error handling when streams terminate abnormally…Every thing is so so cool…

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s