[pulseaudio-discuss] jack soundcard reservation behavior

Lennart Poettering lennart at poettering.net
Mon Aug 3 14:32:22 PDT 2009


On Sat, 01.08.09 08:43, Stéphane Letz (letz at grame.fr) wrote:

>> Taking a name on the bus would be the perfect solution, since it makes
>> sure PA knows exactly when jack becomes available and when jack goes
>> away again. Also if jack dies abnormally D-Bus would clean up the name
>> automatically so this would even be very robust.
>>
>> Lennart
>
> OK.
>
> So I guess the "dbus_bus_request_name/dbus_bus_release_name" pair of  
> functions has to be used right?  (I see that PulseAudio register itself 
> in "register_dbus" function but there is no symetrical "unregister_dbus" 
> that woud use dbus_bus_release_name?)

Yes, PA just takes the name. D-Bus will clean up the name
automatically when PA's connection to the bus drops. That's why we
don't need to unregister the name expclitly.

>
> Is the dbus_bus_release_name mandatory? I mean I am thinking calling  
> dbus_bus_request_name *after* the JACK server has been started (to be  
> sure the PA JACK client can then register) and calling  
> dbus_bus_release_name *before* JACK server stops, but then how to be  
> sure the "stop" notification has really be received/handled by PA before 
> actualy stopping the server?

The name shoiuld be taken at a point where the server is otherwise
perfectly running and accessible. i.e. it should be the last step of
initialization.

As mentioned you don't need to give up the name explicitly since D-Bus
cleans it up anyway if your connection goes away. If you decide to
release it explicitly then the order is not that important since PA
should be made robust enough to properly handle all kinds of errors
from JACK. So if you release thename only as last step and PA's
connection to JACK is already dropped that should be perfectly fine
with PA. (And if it isn't it should be fixed in PA.)

In short: the order for registering the name during initialization
matters, the order for unregistering the name during shutdown does
not.

Lennart

-- 
Lennart Poettering                        Red Hat, Inc.
lennart [at] poettering [dot] net
http://0pointer.net/lennart/           GnuPG 0x1A015CC4



More information about the pulseaudio-discuss mailing list