Configuring sound backend (from PulseAudio to ALSA)?
#1
Question 
How can I configure at runtime (command-line switch or configuration directive) which sound-backend xbmc uses on linux?

I want to use alsa as the sound backend, but paplayer first tries pulseaudio, no matter what I try... This gives a 5 second delay before it switches to alsa (as I do not have pulseaudio installed, it is not installed and not running). After the switch to alsa, audio is fine. This delay happens on every new play of a song or album.

I did try to to search the forum, read all threads on pulseaudio, searched the xbmc wiki, faq, googled etc., but still no clue...

Code:
22:17:05 T:3065481024 M:700002304   DEBUG: PulseAudio: Opening Channels: 2 - SampleRate: 44100 - SampleBit: 16 - R
22:17:05 T:2804882320 M:700018688    INFO: CFileCache::Process - Hit eof.
22:17:10 T:3065481024 M:699957248   DEBUG: PulseAudio: Context failed
22:17:10 T:3065481024 M:699957248   ERROR: PulseAudio: Waited for the Context but it failed
22:17:11 T:3065481024 M:699990016   DEBUG: CALSADirectSound::CALSADirectSound - Channels: 2 - SampleRate: 44100 -
22:17:11 T:3065481024 M:699990016   DEBUG: Initialize - using alsa device default

I found some people that used

Code:
SDL_AUDIODRIVER=alsa xbmc

but after that xbmc still tries pulseaudio first. I understand that I can compile xbmc from source and use --disable-pulse there, but I prefer to use the packaged build as this works fine otherwise. In the GUI configuration I only could select " default" for analog audio. Did I miss something or do I ask for the impossible?

My system:

Build: 9.04.1 Atlantis (SVN:20654) PPA on Debian Lenny.
Hardware: Asus EEE box B202 (Intel Atom, etc.)
Complete log: http://www.pastebin.ca/1455804
Reply
#2
In these forums somewhere I did read that the switch "--disable-pulse " does not disable as you think. It actually disables support for pulse...if I'm not mistaken. If you don't want pulse probably just uninstall it and be sure to purge but...you would probably be better off leaving pulse alone and rather change your audio options under Preferences > Sound to ALSA and remove Pulseaudio from startup using utility sysv-rc-conf and from Preferences > Start Up Applications.
Reply
#3
hexxamillion Wrote:In these forums somewhere I did read that the switch "--disable-pulse " does not disable as you think. It actually disables support for pulse...if I'm not mistaken. If you don't want pulse probably just uninstall it and be sure to purge but...you would probably be better off leaving pulse alone and rather change your audio options under Preferences > Sound to ALSA and remove Pulseaudio from startup using utility sysv-rc-conf and from Preferences > Start Up Applications.

Thanks for your answer. I have purged pulse and it is not available in the preferences. That does not help.. In the meantime I found out that setting SDL_AUDIODRIVER does not work because it is only used for menu sounds, not for actually media playback.

If you would disable 'support' for pulseaudio, that should work, because that means that makes it impossible to to use pulseaudio at all. That would be fine for my problem. However I think this is a compile time switch, not a runtime/configuration switch.

My best guess at the moment is that it is not possible to configure (at runtime) the sound backend for linux. The model choosen by the developers is then that paplayer starts to use pulseaudio and automatically switches to alsa if pulseaudio is not available (because it is purged/killed etc). The 5 second delay in trying to use pulseaudio could be seen as a bug in this regard....

Can anyone confirm this so I can file an on topic bug report?
Reply
#4
In this case your only option is compile and do --disable-pulse. Then XBMC won't try pulseaudio at all. However, it shouldn't give a 5s delay to try pulseaudio, not on any machine I have encountered? Might be debian that have a longer timeout on pulseaudio connect, will need to check this out, definatly a bug or unwanted behaviour Smile

However having a way to choose which soundsystem at runtime sounds like something we would want aswell.

Cheers,
Tobias.
If you have problems please read this before posting

Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.

Image

"Well Im gonna download the code and look at it a bit but I'm certainly not a really good C/C++ programer but I'd help as much as I can, I mostly write in C#."
Reply
#5
Topfs2 Wrote:In this case your only option is compile and do --disable-pulse. Then XBMC won't try pulseaudio at all. However, it shouldn't give a 5s delay to try pulseaudio, not on any machine I have encountered? Might be debian that have a longer timeout on pulseaudio connect, will need to check this out, definatly a bug or unwanted behaviour Smile

However having a way to choose which soundsystem at runtime sounds like something we would want aswell.

Cheers,
Tobias.

Thanks for the confirmation of my suspicion. Any hints on how I can help to debug this delay on Debian?

If necessary I can compile, debug, trace etc. it is just that I do not want to do so forever in the future (and thus the compile time switch is not the favored option).
Reply
#6
Jochem, or anyone else responding on this thread. . .

Did anyone ever figure out how to resolve the 5 second delay issueHuh I'm having the same exact issue with XBMC Live 9.04.1 on a Zotac Ionitx-A-u mobo. Here's my thread link for more info:

http://forum.xbmc.org/showthread.php?tid=58636

To my "Linux challenged" mind, it seems that pulseaudio is the culprit, but unfortunately it also seems that these issues are rarely simple and straight forward. I've read several other threads where people say that pulse audio is not needed and should be removed, Here's one

http://forum.xbmc.org/showthread.php?tid...ight=pulse

so I think we're on the right path!

Anyone know how to remove Pulse audioHuh
Thanks
Pasqual
Reply
#7
You can't without recompiling and you really shouldn't need to, I have the same board (lots have) and am using XBMC Live exclusively with it, and I can't recreate your delay the slightest.

To even begin debugging this you will need to check the "How to post a proper debug post" and post all necessary details.
If you have problems please read this before posting

Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.

Image

"Well Im gonna download the code and look at it a bit but I'm certainly not a really good C/C++ programer but I'd help as much as I can, I mostly write in C#."
Reply
#8
Sorry topfs2, I pointed everyone to my other current thread that discusses this issue and assumed people would refer to that thread for all of my info. I will post it here redundantly for ease of access.

- XBMC Live v9.04.1 r20654 (compiled May 25 2009)
- booting off a Sandisk 8GB USB flash drive
- on a Zotac Ionitx-A-U motherboard
- 4GB RAM.
- All media is played from a SMB share on a Netgear ReadyNAS appliance on my Gigabit network. (Playing these files on my laptop on the same network does NOT reproduce the issue.)

I played a few standard definition stereo WMV files and a few High definition surround sound MTS files. I get approximately the same (4-7 second) delay between when the video starts and when the audio starts, then there is about the same amount of time where the audio is running at normal speed and the video slows down to let the audio catch up, then everything runs in perfect synch for the rest of the video.

The debug log is here:
http://pastebin.com/m11177125
Thank You in advance for helping us out!
Pasqual
Reply
#9
pasqualz Wrote:...
The debug log is here:
http://pastebin.com/m11177125
Thank You in advance for helping us out!
Pasqual

Yes, your problem does seem the same problem as I have. (I didn't describe this, but also have the same delay with video files).

The +/- 5 second delay is not necessary a xbmc bug. It may be xbmc-bug, it may be an pulseaudio (configuration) bug.

You (pasqualz) seem to be using a dedicated xbmc setup. Why not purge pulseaudio entirely? Then the switch to alsa should be instantaneous. For me, I just gave in an used a reconfigured pulseaudio for now (I disabled all the soundcards, than the delay drops to 0 seconds and the switch to alsa is almost instantaneous).

I still think, that even if the delay problem is fixed, xbmc is wrong in first trying pulse, than alsa; it should be runtime configurable, especially since the menu-sound backend _is_ runtime configurable. I did not write the patch however, i don't expect others to do it for me .....
Reply
#10
Jochem,

You, and just about everyone else here, know more about XBMC Live than I do.

Quote:You (pasqualz) seem to be using a dedicated xbmc setup. Why not purge pulseaudio entirely?

What do you mean by dedicated? If you mean that I only use XBMC on thsi computer, you're correct. I assumed that since I'm using XBMC live, thats all i can do with it. I'm a Linux noob.

Can you or anyone else direct me to good instructions for purging pulseaudio?? I would love to try this even if it risks blowing up my XBMC Live install, I'll just reinstall XBMC live and try again!

Quote:For me, I just gave in an used a reconfigured pulseaudio for now (I disabled all the soundcards, than the delay drops to 0 seconds and the switch to alsa is almost instantaneous).

How did you get "reconfigured pulseaudio" on your system? I'd be happy to try this also!

Thank You for any assistance you can offer!
Pasqualz
Reply
#11
Me too.
If I start a video, I get full speed video for about 15 seconds with no audio, then the audio starts from the begining, and the video slows down for the next 15 seconds until the audio catches up, then they are in sync the rest of the time. Any codec, any video file.

I have a Revo, ubuntu 9.04 (not full, minimal plus desktop plus SSH), 2.6.28-15 and XBMC pre 9.10 r23842, digital, hdmi out, stereo downmix, no dts, no dolby digital, and the .asoundrc file.

Tell me what logs might be helpful, and how to get them out of linux, and I'll gladly post them. Sadly I'm a Linux Noob.

It worked fine before I borked my previous install, which was the same as above (maybe not XBMC SVN version). I had to completely start over and remove my partitions.

I don't remember what the old working SVN was, but I had to upgrade it from the standard, as the standard would reboot XBMC when opening certain SMB shares. It was from about a week ago though.

FYI, I spent 3 days trying to figure out why my Rosewill MCE remote would not work despite adding the vendor and device ids to the mceusb2 module and re-compiling, only to find out the big mirror above my couch was reflecting back my plasmas auto-dimming ir signal, and blocking up the rosewill receiver. Hope that helps someone.
Reply

Logout Mark Read Team Forum Stats Members Help
Configuring sound backend (from PulseAudio to ALSA)?0