[lang]

Present Perfect

Personal
Projects
Packages
Patches
Presents
Linux

Picture Gallery
Present Perfect

PulseAudio debug guide ?

Filed under: Hacking — Thomas @ 10:48

2009-09-01
10:48

I subscribe to the dream. I think a lot of features PulseAudio brings to the table are long overdue and very welcome. I even manage to be amused at Lennart's abrasiveness when it comes to defending the software he writes (though it might help that I know the guy). So I have the right mind set, which is why I persevere.

But one thing PulseAudio definitely lacks is transparency. Too much of it feels like black magic. I certainly pretend to know more about Linux audio than the average user, and even then I'm mystified by simple things as 'why does pulseaudio sometimes not seem to be running ? What is responsible for starting it at login time ? Why doesn't it get started when some app starts playing sound ? How do I figure out why sound doesn't work for this application ?'

Today I was reminded again as I ran into some problems with skype (bug filed). PulseAudio asserts and goes away probably because of something Skype does wrong (although one could argue that PulseAudio shouldn't break down completely because of one bad client).

The bug itself is not the point of this post. What I'm lacking in PulseAudio is a way in to understand problems and help create good bug reports. A PulseAudio debugging guide would be excellent to have; one that would tell me 'set up pulseaudio like this to get more info when the crash happens'. Googling doesn't find me a guide, and PulseAudio's website doesn't have one either.

Lennart, if you can give me some starter tips to provide better bug reports I'll volunteer to write up a Trac wiki guide to do the debugging and bug reporting.

No need for the haters to comment on this post - whether it's hate against Skype or PulseAudio :)

12 Comments »

  1. Good idea. PA is superb, but often very annoying, and pita to debug what really is going on.

    Btw. it should be rock-solid in matter of client-server interaction, there should be no client able to bring whole server down.

    Comment by AdamK — 2009-09-01 @ 12:03

  2. On the Fedora wiki there are currently these guides to debug sound problems:
    https://fedoraproject.org/wiki/Bug_info_kernel_sound
    https://fedoraproject.org/wiki/Bug_info_PulseAudio

    If you could improve that, that would certainly be beneficial to a lot of people :)

    Comment by Kamil Páral — 2009-09-01 @ 12:45

  3. I think this idea is really good. Myself I have problems running audio on F11, and think it seems to be somethink realted to powersave (i.e. ondemand), pulseaudio and for some reason it gets worse if the music/video is treamed over bad connection of sshfs…

    …and I have no idea what I should write in the bugreport…

    Comment by Xake — 2009-09-01 @ 14:37

  4. Run in a terminal with -v?

    Comment by Matthew W. S. Bell — 2009-09-01 @ 15:03

  5. We do have one already:

    https://fedoraproject.org/wiki/Bug_info_PulseAudio

    linked from:

    https://fedoraproject.org/wiki/BugsAndFeatureRequests#Information_required_for_bugs_in_specific_components

    do you think this is too hard to find?

    Also see: https://fedoraproject.org/wiki/Bug_info_kernel_sound , and http://pulseaudio.org/wiki/Community#BugsPatchesTranslations (which the Fedora PA page links to). The two pages don’t cover everything you asked, though – expansion is welcome. As Matthew (nearly) says, killing PA and running it in a terminal as ‘pulseaudio -vvvvv’ is a good way to see what’s actually happening within PA, if you hit a problem you can reliably reproduce. In F12+, PA automatically respawns when killed, which gets in the way: to disable it, create a file ~/.pulse/client.conf with the contents ‘autospawn = no’.

    Comment by Adam Williamson — 2009-09-01 @ 16:02

  6. This.

    Comment by Aredridel — 2009-09-01 @ 16:57

  7. Here’s a little guide from our wiki with a few hints how to convince gdb to debug pa:

    http://pulseaudio.org/wiki/Community#BugsPatchesTranslations

    Comment by Lennart — 2009-09-01 @ 17:15

  8. have you tried with the new skype 2.1.0.47, which is using pulse directly, this works much better here.
    http://www.skype.com/intl/en/download/skype/linux/choose/

    Comment by j — 2009-09-01 @ 17:15

  9. I couldn’t help but comment on this, though I assume it will not be excepted if this is moderated.

    Lennart and pulseaudio has been the cause of many wasted hours by many users. I like how no one ever mentions that. I would rather pulseaudio and lennart go away and never come back. I know a dream that will never come to pass with @redhat behind his name. We all have our dreams.

    While you are free to do whatever you please with your time, advising others to help debug pulseaudio is in fact not helping fedora, linux or the community. pulseaudio tried to fill a gap in sound. It has failed and continues to do so. At what point do you cut your losses and move on? I suspect for some the answer is never.

    Comment by tk009 — 2009-09-01 @ 22:20

  10. tk009, you are overly negative. Do you have anything positive to contribute to the free software table ? Where am I advising others to help debug ? What makes you the person to decide that if I were to do so it would not help fedora, linux or the community ?

    Show some zeal, some zest, some spunk, something positive. Nobody likes a nag.

    Comment by Thomas — 2009-09-03 @ 19:02

  11. i’m using skype 2.1.0.47 and i had the exact problem the author reported (today, in fact).

    Comment by Mark T. Kennedy — 2009-09-02 @ 20:19

  12. Try this without pulseaudio:

    1. Start up Rhythmbox. Listen to the music.
    2. Plug in a USB sound card and transfer the music from your onboard audio to the USB device.
    3. Put on a bluetooth headset and then transfer the music to that.
    4. Redirect the output to broadcast over the network so that all your clients play the music.
    5. Call yourself using a SIP client and then have it all automatically lower volume.

    You may say “Wow that is stupid, everybody only listens to music on stereo output”. Well your wrong. The glory days of the ‘Sound Blaster Live!’ and XMMS is _long_, _long_ gone. The world has moved on. Linux hasn’t. That is until PA.

    Go and look at Best Buy. Go and look at Newegg.com:
    http://www.newegg.com/Store/SubCategory.aspx?SubCategory=707&name=Headsets-Accessories

    Do a search for ‘microphone’. Now click and look at ‘Connector’. Look at the numbers. When I did that there were 41 microphones that connected to your computer with USB. USB?! They are headphones with built-in sound card.

    Why do they have them? Because this way users can play video games and have the stereo running while doing VoIP with the other gamers. It’s more convenient to use those then to unplug your speakers when you want to do VoIP. Stuff like that. It’s very common. Could you imagine telling people who are accustomed to using speakers, but being able to plug in USB headphones to make and answer calls that they are going to have to hack on Linux to make that work?

    lets see what you have to do with Alsa.

    First off you need to fix Linux so that the devices are numbered the same after a reboot. I’ve ran into situations were you had no less then 3 separate audio devices plugged into a computer:

    1. Onboard Audio
    2. Webcam (onboard Micrphone)
    3. Headset

    So the first thing you have to do is edit Udev rules so that they are inumerated the same every time. Depending on how they are booted up their numbers will change. Sometimes the webcam will be sound card 0, sometimes onboard, sometimes headset. It all depends what is plugged in and were it’s plugged in. Essentionally random. So you need to fix that.

    Next step you need to do is create a bunch of custom asoundrc code. Setup hw0, hw1, etc etc.
    Need to setup a default device.
    A dmix device.
    A dsnoop device.
    Then a Asym device.
    Then you need to figure out what the defaults are going to be. Probably screw around with various settings and buffers to get the best sound.

    After you get that done then you need to go and play around with the mixer levels. Use alsamixer to play with low-level hardware and low-level virtual sliders. A lot of it does not make much sense, even when you know what the terms are. You have to figure out the correct levels for the onboard line-in and microphone, headset microphone, and webcam microphone.

    Once you get those tested and working then you need to configure each and every application.

    Obviously you’d want your VoIP to use the Microphone and speakers on your headset. But you need to have the VoIP app running all the time in order to get people ringing in… so I guess you can’t unplug your headset anymore.

    So then configure mplayer to use what you want if it’s not the defualt. Configure Ekiga, configure Linphone, configure everything that you want to use that is not exactly the default. Once you get that done then you need to get the mixer levels on your applications correct. And after a week or two of mucking around with it you’ll have a decent setup. And it will still suck and be difficult to use.

    So.. ya… I have a bluetooth, I have a bluetooth enabled laptop. It should be a match made in heaven, but it’s not. Why? Because it’s running Linux. PA is fixing this.

    And for the record the Palm Pre runs PulseAudio for it’s sound. If it can work for a ARM system in a phone then it can work well for your desktop. It’s just up to your distro to get it right.

    Comment by nate — 2009-09-05 @ 05:15

RSS feed for comments on this post. TrackBack URL

Leave a comment

picture