Linux - PulseAudio Sink

  Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
fritsch Offline
Team-Kodi Developer
Posts: 15,160
Joined: Aug 2011
Reputation: 455
Location: Stuttgart*
Post: #1
This writeup has been extended and moved to the wiki: http://wiki.xbmc.org/index.php?title=PulseAudio


PulseAudio Sink in Gotham
Background
in the past we had immense problems with users not getting Audio, cause they had a full blown Ubuntu Desktop environment together with PulseAudio installed. PulseAudio blocked the specific device and Audio Playback only worked reliable when using the virtual pulse device. Our workaround for those users was to uninstall pulseaudio. This broke complete Desktop Audio for those. We want this situation to change with Gotham.

Changes in Gotham
Users that run a normal Ubuntu Desktop and just use xbmc for normal video / audio playback while also wanting Audio in parallel in their browser or pause xbmc, run a game or rhythmbox / skype or whatever, they can now use our new PulseAudio Sink.

Technical Background
This Sink automatically detects if PulseAudio is running and _so_ assumes that the User, which installed PA and uses PA, also wants to use it. This PulseAudio Sink is also able to do AC3, DTS and EAC3 passthrough. Alternatively it can be configured to be a 7.1 or 5.1 output device. This is an exclusive OR. PulseAudio only provides AC3, DTS, EAC3 when it is configured to run with 2 channels (which is the default on every Desktop).

So in order to activate Passthrough Codecs, just use pavucontrol, like in the following:
[Image: pavucontrol.png]

To alternatively configure Multi channel, check this:
[Image: pavucontrol-channels.png]

PA will be enabled default in Gotham. For plain ALSA people, PA detects that it is not running and will just use ALSA as it was used before. Nothing will change for you.

PulseAudio does not support DTS-HD, TrueHD. If you need those codecs, stop pulseaudio prior to starting xbmc. Every other combination that might have worked for your _before_ was pure luck.

FAQ:
When would I want Pulseaudio:
- You use your xbmc computer mainly as your Desktop when you don't run xbmc
- You want other sounds like Skype, youtube, browser mail notification in parallel
- You use xbmc windowed as Desktop player
- You use Pulseaudio as a network sink to stream Audio to other devices in your living room
- Passthrough is nice to have for you, but to be honest - you don't really need it.
- Whenever you plugin your BT headset, xbmc audio will continue over this new device (when Default (PULSE) device is chosen)

When would I want ALSA:
- You use xbmc as your standalone media center
- You are highly interested in bitperfect exclusive audio output
- DTS-HD, TrueHD is something you use daily and is of high importance
- You don't need other applications that would access audio in parallel

Why can't I have both:
- PA might hogg your Audio device and you cannot open the ALSA device exclusively, therefore we decided for one or the other.

Can I force ALSA, though I have pulseaudio installed and running and know that it causes problems:
- Yes, you can - start xbmc from terminal with:
Code:
AE_SINK=ALSA xbmc
- Be warned as this might interfer with your Desktop sounds and PA

What Pulse supports:
- Passthrough: AC3, DTS, EAC3 (when configured as digital stereo)
- Multichannel Output (when configured as 5.1 device)

What Pulse does not do:
- DTS-HD, TrueHD passthrough

Possible problems:
- Ubuntu 13.10 has a bug and passthrough might sound like noise, if you are affected only disabling passthrough helps. This is a distribution bug (OpenELEC, Arch, Debian, OpenSUSE works with the same code)
- Passthrough is always exclusive mode. If you have another application hogging the device, e.g. google chrome or skype or something else, Passthrough won't work.
(This post was last modified: 2014-09-30 08:54 by fritsch.)
find quote
wsnipex Offline
Team-Kodi
Posts: 5,847
Joined: Jun 2011
Reputation: 137
Post: #2
Quote:PS: xbmc-nightlies don't have PA enabled yet. If you are using the famous fernentmenta-master branch packaged by wsnipex, here it is already enabled.
also mainline nightlies already have pulse enabled.
find quote
un1versal Offline
Out of Memory
Posts: 7,124
Joined: Oct 2012
Reputation: 169
Location: Binary Pulsar
Post: #3
Stick this in stikies... Wink
find quote
nickr Offline
Super Moderator
Posts: 15,340
Joined: May 2009
Reputation: 308
Location: Christchurch NZ
Post: #4
Thanks fritsch. This will make a lot of desktop users happy, and support easier.

If I have helped you or increased your knowledge, click the 'thank user' button to give thanks :) (People with less than 20 posts won't see the "Thank you" button.)
find quote
fritsch Offline
Team-Kodi Developer
Posts: 15,160
Joined: Aug 2011
Reputation: 455
Location: Stuttgart*
Post: #5
I will add an option for the "I want my ALSA back, though I know it highly interfers with the PA I installed users" to start xbmc with:
Code:
AE_SINK=ALSA xbmc
(This post was last modified: 2014-01-15 22:34 by fritsch.)
find quote
nickr Offline
Super Moderator
Posts: 15,340
Joined: May 2009
Reputation: 308
Location: Christchurch NZ
Post: #6
In fact this deserves a place all by itself on the xbmc front page blog.

If I have helped you or increased your knowledge, click the 'thank user' button to give thanks :) (People with less than 20 posts won't see the "Thank you" button.)
find quote
un1versal Offline
Out of Memory
Posts: 7,124
Joined: Oct 2012
Reputation: 169
Location: Binary Pulsar
Post: #7
(2014-01-15 22:32)fritsch Wrote:  I will add an option for the "I want my ALSA back, though I know it highly interfers with the PA I installed users" to start xbmc with:
Code:
AE_SINK=ALSA xbmc

How would you use this in theory? Not that I use pulse or have it installed anyway, just for curiosity and documenting it in my mind...

(2014-01-15 22:32)nickr Wrote:  In fact this deserves a place all by itself on the xbmc front page blog.

* un1versal sticks hand up for the writing!

But then, I remember the disdain for jumping through hoops and swallowing big toads and gate keepers to get anything done in wiki. Not a fan of totalitarians who are just suspicious of contributors and then I remember, what's love gotta do with it... So then I use XBMC and am, like awww.
(This post was last modified: 2014-01-15 23:04 by un1versal.)
find quote
fritsch Offline
Team-Kodi Developer
Posts: 15,160
Joined: Aug 2011
Reputation: 455
Location: Stuttgart*
Post: #8
Some people in fact _can_ manage their Audio. They have for example PA set to use their Analog Output for their desktop sounds. Now they want to use HDMI for xbmc with alsa to use DTS-HD, TrueHD and so on. For those use cases they need xbmc in ALSA mode. As xbmc will automatically use PulseAudio if it is running, they need a way to bypass this to make work, what they had earlier.

It's more a pratical question :-)
find quote
nickr Offline
Super Moderator
Posts: 15,340
Joined: May 2009
Reputation: 308
Location: Christchurch NZ
Post: #9
What are you asking? The best way to set an environment variable in linux? Just running the line fritsch gave should work, or wend it into whatever script you use to start xbmc. There are so many ways to start xbmc that it's hard to be definitive.

If I have helped you or increased your knowledge, click the 'thank user' button to give thanks :) (People with less than 20 posts won't see the "Thank you" button.)
find quote
un1versal Offline
Out of Memory
Posts: 7,124
Joined: Oct 2012
Reputation: 169
Location: Binary Pulsar
Post: #10
Ahhh that idk xinit in int for me xbmc.conf
find quote
evanpurkhiser Offline
Member
Posts: 74
Joined: May 2012
Reputation: 0
Post: #11
This is great news! Thank you to everyone involved in making a PulseAudio sink available for XBMC! Great work!
find quote
ixbeemce Offline
Junior Member
Posts: 35
Joined: Nov 2013
Reputation: 0
Post: #12
@fritsch

You mentioned that Sink does not work with DTS-HD or TRUE-HD.
It this also true if passthrough is used?
find quote
evanpurkhiser Offline
Member
Posts: 74
Joined: May 2012
Reputation: 0
Post: #13
Just built the latest version from git. It's working great. I did notice that no other sink-inputs can be active when playing back a video with AC3 or DTS audio or the passthrough simply won't happen, I suspect this might be a limitation of PulseAudio?

On a side note, I did also notice that vdpau appears to be broken for me in my build. But I can just leave that disabled for now, PulseAudio support is well worth it (plus multi-threaded ffmpeg works great!) =)
find quote
wsnipex Offline
Team-Kodi
Posts: 5,847
Joined: Jun 2011
Reputation: 137
Post: #14
(2014-01-16 10:42)ixbeemce Wrote:  @fritsch

You mentioned that Sink does not work with DTS-HD or TRUE-HD.
It this also true if passthrough is used?

yes, no HD audio support in pulseaudio.
find quote
wsnipex Offline
Team-Kodi
Posts: 5,847
Joined: Jun 2011
Reputation: 137
Post: #15
(2014-01-16 10:57)evanpurkhiser Wrote:  Just built the latest version from git. It's working great. I did notice that no other sink-inputs can be active when playing back a video with AC3 or DTS audio or the passthrough simply won't happen, I suspect this might be a limitation of PulseAudio?

On a side note, I did also notice that vdpau appears to be broken for me in my build. But I can just leave that disabled for now, PulseAudio support is well worth it (plus multi-threaded ffmpeg works great!) =)

debug log?
find quote
Post Reply