[pulseaudio-discuss] Need a way to check when start-pulseaudio-x11 fully initialized

Tanu Kaskinen tanu.kaskinen at linux.intel.com
Fri Aug 15 08:55:14 PDT 2014


On Wed, 2014-08-13 at 14:22 -0700, John wrote:
> ----- Original Message -----
> > From: Tanu Kaskinen <tanu.kaskinen at linux.intel.com>
> > To: John <da_audiophile at yahoo.com>
> > Cc: "pulseaudio-discuss at lists.freedesktop.org" <pulseaudio-discuss at lists.freedesktop.org>
> > Sent: Wednesday, August 13, 2014 3:52 AM
> > Subject: Re: [pulseaudio-discuss] Need a way to check when start-pulseaudio-x11 fully initialized
> > 
> > On Tue, 2014-08-12 at 15:08 -0700, John wrote:
> > 
> >>  I need use something to query /usr/bin/pulseaudio and to ask it if it
> >>  is fully initialized.  Right now, starting xbmc in stand-alone mode
> >>  through a systemd service causes xbmc to start before pulse-audio is
> >>  fully initialized which results in xbmc not being able to see all of
> >>  the audio devices on the system.  Can someone suggest a method that
> >>  will basically return an exit code of 0 when PA is initialized and a
> >>  non-0 code when it is not ready?
> > 
> > What devices XBMC doesn't see? Currently alsa devices are loaded
> > synchronously during startup, and client connections are not served
> > until the startup is complete. This means that clients should see all
> > alsa devices no matter when they connect, because their queries won't be
> > served until the startup is complete. Bluetooth devices are a different
> > matter, because they're not loaded synchronously.
> 
> My system has three devices on it. If I
> modify /usr/bin/xbmc-standalone to more or less look like the
> following, all three of the audio sources are detected by xbmc:
> 
>   /usr/bin/start-pulseaudio-x11
>   sleep 6s
>   /usr/bin/xbmc --standalone
> 
> If I do not have that "sleep 6s" line in there, only the first device
> is detected, but it is the one I don't want to use :(
> 
> It will be obvious to you in the logs:
> 
> 1) Link to xbmc.log started WITH the 6sec delay (i.e. works fine):
> https://gist.github.com/graysky2/25ff0f511945d25e15d8
> 
> 2) Link to xbmc.log started WITHOUT the 6sec delay (i.e. not all
> devices are detected):
> https://gist.github.com/graysky2/65ba59602d4b3f31160f

The XBMC logs talk about "enumerated alsa devices", which sounds very
much like XBMC is not using pulseaudio to enumerate the devices. Maybe
it doesn't use pulseaudio for streaming either.

I suspect that what happens is that when pulseaudio starts, it opens the
HDMI and analog devices, keeps them open for 5 seconds, and then
suspends them. Without the extra delay, XBMC can't use the devices while
pulseaudio has them open, so only the digital output works for XBMC
(pulseaudio only ever uses either analog or spdif at any given time, not
both). With the extra delay, pulseaudio has released the devices by the
time XBMC tries to use them.

Does XBMC work if you don't start pulseaudio at all?

-- 
Tanu



More information about the pulseaudio-discuss mailing list