PulseAudio and XBMC for linux

January 9th, 2009 topfs2

Since the release of Atlantis we have had dozens of new users, and a few noted one of our weaknesses, which was PulseAudio, link to thread. People usually experienced video that ran in great speed, this was because ALSA couldn´t create a stream. And the only way of making XBMC run like it should on Ubuntu was to kill PulseAudio, this is ok if you are only using the computer as a HTPC but will quickly take away the fun of having XBMC just as a media player along with the rest of the desktop, as without PulseAudio most of the other applications won´t work properly.

Anyway, the days of having to kill PulseAudio is now gone! in SVN we have added full native support for PulseAudio, this works in both DVDPlayer and PAPlayer. This is also a runtime drop in replacement for ALSA so if PulseAudio crashed or got killed XBMC would fallback and use ALSA. We also added a gui notification when XBMC failed to open either ALSA or PulseAudio so the user this time knows that there actually was an error without hitting the log. So if you see this please check your audiosettings and if nothing seems wrong provide a log on the forum

A feature of PulseAudio is that it´s network transparent, and as such you can connect to a remote computer and have it play the audio. And of course we added this to XBMC, just create an advancedsettings.xml as this:

<advancedsettings>

<audio>

<audiohost>PulseAudio Server IP</audiohost>

</audio>

</advancedsettings>

And it should connect to the other computer.

Known issues:

  • Navigational sounds is still dependent on SDL, export SDL_AUDIODRIVER=esd before entering XBMC might help.
  1. January 10th, 2009 at 23:37 | #1

    Should be noted though that PulseAudio still do not support digital pass-through to SP/DIF :(

    …and also having the PulseAudio Server IP settings in the XBMC GUI someday would be really nice ;)

  2. nat
    January 13th, 2009 at 14:08 | #2

    I pulled xbmc last night on a very vanilla install Ubuntu 8.10 and had all sorts of stability problems – is that something special to U8.10 or is it the pulseaudio issue? Is there any action that needs to be taken to resolve the pulseaudio issue on my end, or is it just fixed?

    Thanks!

  3. topfs2
    January 13th, 2009 at 14:50 | #3

    Yup this is just fixed, we added PulseAudio support after XBMC 8.10 (atlantis) so if you want to run XBMC and PulseAudio you should download and compile XBMC from source, or wait until next stable release.

    In the meantime if you dont want to do either of the above suggestions you´d need to disable PulseAudio.

  4. nat
    January 13th, 2009 at 17:24 | #4

    Excellent. I’ll do my best with that.

  5. stuart
    January 14th, 2009 at 11:32 | #5

    Is 5.1 analogue out enabled now, with or without pulseaudio? This is the only thing stopping XBMC being perfect for movie playback on my machine (I cannot afford and do not need a £300 amp just to do surround sound).

    Keep up the good work.

  6. topfs2
    January 14th, 2009 at 11:55 | #6

    To be honest, I always thought it was enabled :)

    In anycase, I´ve tried 5.1 on pulseaudio with XBMC when I developed the pulseaudio support and it worked (I dont have 5.1 speakers but I got only left and right audio in my headphones, center and the others were left out so I guessed it worked).

    If it doesnt you should file a ticket on trac with full debuglog and explain the problem.

    Noteworthy you might need to enable 6ch in configurationfiles on PulseAudio to get the server to understand you have 5.1, currently we cant query this information (havent found a method for it in PulseAudio api) so we just assume its correctly setup.

    I hope you got your question answered, otherwise post and I will gladly try to explain myself better :)

  7. TecnoBrat
    January 15th, 2009 at 00:56 | #7

    After talking to topfs2 in IRC, I was able to resolve a problem I was having with pulse + alsa with losing the menu click sounds after playing video (at least partially).

    First install libsdl pulseaudio

    sudo apt-get install libsdl1.2debian-pulseaudio

    Then I start XBMC normally and the menu clicks work before and after playing video. The only problem is there is a slight delay, probably about a 200ms delay or so (for the menu sounds only, not video).

  8. topfs2
    January 15th, 2009 at 05:22 | #8

    Thx TecnoBrat!, there is some talk about audio delay on the SDL mailing list and hopefully it will be resolved sooner or later.

    Did you end up using SDL_AUDIODRIVER=esd or SDL_AUDIODRIVER=pulse ?

  9. April 3rd, 2009 at 10:30 | #9

    Thanks for the interesting and informative site. That’s definitely what I’ve been looking for.

Comments are closed.