Do not explicitly start daemon in start-pulseaudio-x11

Bug #513120 reported by Martin Pitt
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
pulseaudio (Ubuntu)
Fix Released
Low
Luke Yelavich

Bug Description

Binary package hint: pulseaudio

Right now, pulseaudio is started about three or four times during boot [1], which wastes precious cycles.

For example, /etc/xdg/autostart/pulseaudio.desktop runs /usr/bin/start-pulseaudio-x11, which is a shell script which in turn calls pulseaudio (which exits after a while since it is already running), and then loads three additional modules with pactl.

Can these three modules just go into /etc/pulse/default.pa, and the autostart desktop and start-pulseaudio-x11 be dropped?

[1] http://people.canonical.com/~pitti/bootcharts/daniel-lucid-20100127-1.png

Tags: ubuntu-boot
Revision history for this message
Martin Pitt (pitti) wrote :

Luke, can you please review this idea? I'm fine to implement this, but I'd like to get some review on that first. Thanks!

Changed in pulseaudio (Ubuntu):
assignee: nobody → Luke Yelavich (themuso)
Revision history for this message
Daniel T Chen (crimsun) wrote : Re: [Bug 513120] Re: Can /etc/xdg/autostart/pulseaudio.desktop be dropped?

Please note the existing comment in /etc/pulse/default.pa:

"# X11 modules should not be started from default.pa so that one daemon
# can be shared by multiple sessions."

What are the implications on, e.g., user-switching with user A logged
in from multiple terminals?

Revision history for this message
Martin Pitt (pitti) wrote : Re: Can /etc/xdg/autostart/pulseaudio.desktop be dropped?

I saw the comment, but I cannot make much sense of it. If I log in twice, then I'd get two sets of pactl, each loading the same modules. If having an x11 module loaded with several user sessions is a problem, how does it make a difference whether it's loaded by pactl or from default.pa?

Or does this apply to the system-wide daemon mode? In that case, doesn't that use /etc/pulse/system.pa instead of default.pa?

Revision history for this message
Martin Pitt (pitti) wrote :

Oh, I see the difference: without the autostart file, the module would only be loaded once and for all. start-pulseaudio-x11 additionally submits the $DISPLAY.

That's still going to break with multiple user sessions either way:

 (1) with default.PA the "current" $DISPLAY would be the first session of that user, ever

 (2) with start-pulseaudio-x11 the "current" $DISPLAY will always be the session that was started last, and previous sessions would lose the module (assuming that this actually reloads the module); OTOH, if trying to load an already loaded module is a no-op, then it should be no different to (1)?

If PA really wants to do proper support for multiple sessions with one daemon, it needs to add a /usr/lib/ConsoleKit/run-seat.d/ script.

Revision history for this message
Martin Pitt (pitti) wrote :

So, due to a bug in X.org/console handling/whatever I can't currently start two X.orgs at the same time, so I'm unable to test this myself. If a second X session for the same user would result in those modules being loaded twice (one for each $DISPLAY), this could indeed work.

One remaining thing that could be dropped from start-pulseaudio-x11 is the /usr/bin/pulseaudio --start. It's already running at that time anyway (and thus just wastes a process and cycles), and even if not, pactl will trigger it itself (due to the library auto-spawning the daemon).

Revision history for this message
Martin Pitt (pitti) wrote :

Daniel, saw your branch and merge proposal. Thanks!

summary: - Can /etc/xdg/autostart/pulseaudio.desktop be dropped?
+ Do not explicitly start daemon in start-pulseaudio-x11
Changed in pulseaudio (Ubuntu):
importance: Undecided → Low
status: New → In Progress
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package pulseaudio - 1:0.9.22~0.9.21+stable-queue-32-g8478-0ubuntu2

---------------
pulseaudio (1:0.9.22~0.9.21+stable-queue-32-g8478-0ubuntu2) lucid; urgency=low

  * debian/01PulseAudio: Use su(1) instead of sudo(8)
    (LP: #489144, #498980).
  * debian/patches/series: To trim the startup time, don't lazy-load
    sounds by not applying 0005-load-sample-dir-lazy.patch.
  * 0091-dont-load-cork-music-on-phone.patch: Refresh.
  * 0057-load-module-x11-bell.patch: Don't explicitly load the daemon
    since it will autospawn if necessary, and if the system or user
    configuration has autospawn disabled it breaks that semantics
    (LP: #513120).
 -- Daniel T Chen <email address hidden> Fri, 29 Jan 2010 14:37:52 -0500

Changed in pulseaudio (Ubuntu):
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.