[pulseaudio-discuss] question about parameter "server" for paplay on 0.9.13?

Chen, Hao H hao.h.chen at intel.com
Mon Nov 24 18:02:57 PST 2008


Your answer is quite useful. Thanks, colin. 

For 0.9.12, I've just noticed that DBUS machine-id is used. In fact during PA startup, the log indicates that(could use -v to print log)
...
I: main.c: Machine ID is 6d067982d3a46b2528c74d2649270a3e.
I: main.c: Using runtime directory /home/haohaot/.pulse/6d067982d3a46b2528c74d2649270a3e:runtime.
...
In fact, this symbol link "6d067982d3a46b2528c74d2649270a3e:runtime" links to /tmp/pulse-PKdhtXMmr18n

In addition, according to your reply, I have some extended questions. I'll send other mails in order not to make this mail too long.

Hao


-----Original Message-----
From: pulseaudio-discuss-bounces at mail.0pointer.de [mailto:pulseaudio-discuss-bounces at mail.0pointer.de] On Behalf Of Colin Guthrie
Sent: 2008年11月21日 21:34
To: pulseaudio-discuss at mail.0pointer.de
Subject: Re: [pulseaudio-discuss] question about parameter "server" for paplay on 0.9.13?

Chen, Hao H wrote:
> On version 0.9.13:
> ===============
> By printing debug information, I found default server name  is  "/root/.pulse/localhost.localdomain:runtime/native", in fact "/root/.pulse/localhost.localdomain:runtime " is symbole link to "/tmp/pulse-jCDIIAIDl73a". (everytime the name is different, while pattern is /tmp/pulse-<random>)
> 
> The files in directory "/tmp/pulse-<random>" would be generated everytime PA server starts up and cleaned when PA quits.
> 
> So I tried to "paplay --server=/root/.pulse/localhost.localdomain:runtime/native <wav file>", it's working.

Some info. The <random> bit shouldn't change every time PA starts up. It 
should be reused (I think.... could be wrong here)

The randomness is needed to stop other users hijacking the defined 
folder names in /tmp to essentially run a DoS on your audio capability.

This behaviour is actually different now in git master which uses a 
different prefix that is not based on your hostname (as this can change 
with dhcp etc.) and instead generates a "machine id" that should stay 
the same on a given machine (this also means that if you access pulse 
via NFS on multiple machines you will have separate volume tables etc. 
which is almost certainly what you want!)

Now your examples show pulse running as root. Generally that doesn't 
happen (as it's not often you run as root directly, more often a normal 
user) but that should be OK. I presume you are root all the way?


> On version 0.9.10:
> ===============
> /tmp/pulse-<user>/ would be used, ex "/tmp/pulse-root"
> I tried "paplay --server=/tmp/pulse-root/native <wav>" it's working, while I couldn't find where the symbol link is.
> 
> Some points
> => It's not easy to guess server name like this. It's better to have it documented or put in help info.

Well you shouldn't have to specify --server at all. That's why it's not 
documented outside of developer areas... it's not something users should 
ever have to deal with.

Pulse has three ways to work out how to find the correct socket to use.

1. As specific arguments for some utilities (not usually exposed in 
non-pulse apps).
2. As specified in ~/.pulse/client.conf or /etc/pulse/client.conf
3. As environment variables (env | grep PULSE)
4. As specified by X11 properties of the root window in an X11 session. 
(xprop -root | grep PULSE)
5. Fall back to default.

In theory pulse should go through that list (I think I got the order 
right... going from memory)

Quite why you have to specify it I don't know. It could be related to 
running as root perhaps.



To reply to your original question, you shouldn't have to specify any 
server name pa_context_connect(). The client library should work all 
this out for you and automatically read the various config options as 
per the above list.

In paplay itself, it takes a command line argument for the server in 
this case *it* would pass this trhough to pa_context_connect(), but 
that's because the user has told it what server to use. It doesn't work 
this out for itself.

Just pass a null value for the server name and everything should work:
http://0pointer.de/lennart/projects/pulseaudio/doxygen/context_8h.html#983ce13d45c5f4b0db8e1a34e21f9fce

(remember that paman (which you originally used in your first email) is 
just another pulse client, so if it connects OK, this is just what your 
code will be doing too!)

 > => In addition, for PA server on other PC in the same network, how to
 > specify the server name?


On a network, you would need to make sure you have module-native-tcp 
loaded and that permissions (ACL access list) are such that the remote 
machine is allowed to connect. You then just specify the server as a DNS 
name or IP address.

Again, you shouldn't have to worry about this unless you app 
specifically exposes such low level options to the user.


HTHs

Col


-- 

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

Day Job:
   Tribalogic Limited [http://www.tribalogic.net/]
Open Source:
   Mandriva Linux Contributor [http://www.mandriva.com/]
   PulseAudio Hacker [http://www.pulseaudio.org/]
   Trac Hacker [http://trac.edgewall.org/]

_______________________________________________
pulseaudio-discuss mailing list
pulseaudio-discuss at mail.0pointer.de
https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss


More information about the pulseaudio-discuss mailing list