[pulseaudio-discuss] How pulseaudio support autospawn?

Colin Guthrie gmane at colin.guthr.ie
Tue May 10 09:28:14 PDT 2011


Hello,

'Twas brillig, and Lin, Mengdong at 10/05/11 08:37 did gyre and gimble:
> How pulseaudio support autospawn?
> 
> After pulse audio daemon is killed manually, how it will be executed
> automatically?  How can it know some client is attempts to connect to
> it? Could someone introduce its internal implementation?

This is performed automatically by libpulse.

All pulseaudio client appliations (be them native applications
supporting PA directly or an ALSA application using the alsa->pulse
plugin) use libpulse. It has code that tries to connect to the daemon,
and if that connection fails it will automatically attempt to spawn a
pulseaudio daemon and then connect to it.

There are some exceptions to this e.g.
 * when the client application is trying to connect to a remote address.
 * when autospawn=no is set in client.conf
 * possibly a couple more I forget off the top of my head :D

> 
> I got a explanation of autospawn: “ if the daemon is not running when
> the first client attempts to connect, it will be executed automatically”
> 
> (From
> http://www.linux-archive.org/ubuntu-development/246411-notable-changes-jauntys-pulseaudio.html)
> But I hope someone can give more detail.

So the code itself is here:
http://git.0pointer.de/?p=pulseaudio.git;a=blob;f=src/pulse/context.c;h=1480af533a57cc4eca39bff405973ba4bc8f94c6;hb=HEAD#l802

which is triggered from here:
http://git.0pointer.de/?p=pulseaudio.git;a=blob;f=src/pulse/context.c;h=1480af533a57cc4eca39bff405973ba4bc8f94c6;hb=HEAD#l868


Hopefully you can follow things through from here, but feel free to ask
any other questions if you're stuck :)

Cheers

Col

-- 

Colin Guthrie
gmane(at)colin.guthr.ie
http://colin.guthr.ie/

Day Job:
  Tribalogic Limited [http://www.tribalogic.net/]
Open Source:
  Mageia Contributor [http://www.mageia.org/]
  PulseAudio Hacker [http://www.pulseaudio.org/]
  Trac Hacker [http://trac.edgewall.org/]




More information about the pulseaudio-discuss mailing list