summaryrefslogtreecommitdiffstats
path: root/src/daemon
diff options
context:
space:
mode:
Diffstat (limited to 'src/daemon')
-rw-r--r--src/daemon/daemon-conf.c2
-rw-r--r--src/daemon/daemon.conf.in2
-rwxr-xr-xsrc/daemon/default.pa.in30
-rw-r--r--src/daemon/main.c9
-rw-r--r--src/daemon/polkit.c5
-rw-r--r--src/daemon/pulseaudio-module-xsmp.desktop10
-rw-r--r--src/daemon/pulseaudio.desktop10
-rwxr-xr-xsrc/daemon/start-pulseaudio-x11.in31
-rwxr-xr-xsrc/daemon/system.pa.in54
9 files changed, 125 insertions, 28 deletions
diff --git a/src/daemon/daemon-conf.c b/src/daemon/daemon-conf.c
index 9ac40901..50b812dc 100644
--- a/src/daemon/daemon-conf.c
+++ b/src/daemon/daemon-conf.c
@@ -62,7 +62,7 @@ static const pa_daemon_conf default_conf = {
.realtime_scheduling = FALSE,
.realtime_priority = 5, /* Half of JACK's default rtprio */
.disallow_module_loading = FALSE,
- .exit_idle_time = -1,
+ .exit_idle_time = 20,
.module_idle_time = 20,
.scache_idle_time = 20,
.auto_log_target = 1,
diff --git a/src/daemon/daemon.conf.in b/src/daemon/daemon.conf.in
index dfabcfb2..41c26e2a 100644
--- a/src/daemon/daemon.conf.in
+++ b/src/daemon/daemon.conf.in
@@ -32,7 +32,7 @@
; realtime-scheduling = no
; realtime-priority = 5
-; exit-idle-time = -1
+; exit-idle-time = 20
; module-idle-time = 20
; scache-idle-time = 20
diff --git a/src/daemon/default.pa.in b/src/daemon/default.pa.in
index aad9f5d6..917fc309 100755
--- a/src/daemon/default.pa.in
+++ b/src/daemon/default.pa.in
@@ -16,6 +16,9 @@
# along with PulseAudio; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+# This startup script is used only if PulseAudio is started per-user
+# (i.e. not in system mode)
+
.nofail
### Load something into the sample cache
@@ -80,14 +83,6 @@ load-module module-always-sink
### Automatically suspend sinks/sources that become idle for too long
load-module module-suspend-on-idle
-### Load X11 bell module
-#load-module module-x11-bell sample=bell-windowing-system
-
-### Register ourselves in the X11 session manager
-# Deactivated by default, to avoid deadlock when PA is started as esd from gnome-session
-# Instead we load this via /etc/xdg/autostart/ and "pactl load-module" now
-#load-module module-x11-xsmp
-
### If autoexit on idle is enabled we want to make sure we only quit
### when no local session needs us anymore.
load-module module-console-kit
@@ -104,12 +99,21 @@ load-module module-gconf
.fail
.endif
+# X11 modules should not be started from default.pa so that one daemon
+# can be shared by multiple sessions.
+
+### Load X11 bell module
+#load-module module-x11-bell sample=bell-windowing-system
+
+### Register ourselves in the X11 session manager
+#load-module module-x11-xsmp
+
### Publish connection data in the X11 root window
-.ifexists module-x11-publish@PA_SOEXT@
-.nofail
-load-module module-x11-publish
-.fail
-.endif
+#.ifexists module-x11-publish@PA_SOEXT@
+#.nofail
+#load-module module-x11-publish
+#.fail
+#.endif
### Make some devices default
#set-default-sink output
diff --git a/src/daemon/main.c b/src/daemon/main.c
index 14594416..5fc9f01c 100644
--- a/src/daemon/main.c
+++ b/src/daemon/main.c
@@ -496,7 +496,7 @@ int main(int argc, char *argv[]) {
if (conf->high_priority && (conf->cmd == PA_CMD_DAEMON || conf->cmd == PA_CMD_START))
pa_raise_priority(conf->nice_level);
- if (pa_have_caps()) {
+ if (!real_root && pa_have_caps()) {
pa_bool_t drop;
drop = (conf->cmd != PA_CMD_DAEMON && conf->cmd != PA_CMD_START) || !conf->realtime_scheduling;
@@ -627,6 +627,11 @@ int main(int argc, char *argv[]) {
goto finish;
}
+ if (conf->cmd == PA_CMD_START && conf->system_instance) {
+ pa_log("--start not supported for system instances.");
+ goto finish;
+ }
+
if (conf->cmd == PA_CMD_START) {
/* If we shall start PA only when it is not running yet, we
* first take the autospawn lock to make things
@@ -762,8 +767,6 @@ int main(int argc, char *argv[]) {
/* If we are already running and with are run in
* --start mode, then let's return this as success. */
- pa_log_info("z=%i rock!", z);
-
retval = 0;
goto finish;
}
diff --git a/src/daemon/polkit.c b/src/daemon/polkit.c
index 256e3199..08155cf2 100644
--- a/src/daemon/polkit.c
+++ b/src/daemon/polkit.c
@@ -54,6 +54,11 @@ int pa_polkit_check(const char *action_id) {
goto finish;
}
+ /* There seems to be a bug in some versions of D-Bus that causes
+ * dbus_shutdown() to call exit() when a connection without this
+ * flag disabled was created during runtime.*/
+ dbus_connection_set_exit_on_disconnect(bus, FALSE);
+
if (!(caller = polkit_caller_new_from_pid(bus, getpid(), &dbus_error))) {
pa_log_error("Cannot get caller from PID: %s", dbus_error.message);
goto finish;
diff --git a/src/daemon/pulseaudio-module-xsmp.desktop b/src/daemon/pulseaudio-module-xsmp.desktop
deleted file mode 100644
index fa719a73..00000000
--- a/src/daemon/pulseaudio-module-xsmp.desktop
+++ /dev/null
@@ -1,10 +0,0 @@
-[Desktop Entry]
-Version=1.0
-Encoding=UTF-8
-Name=PulseAudio Session Management
-Comment=Load module-x11-xsmp into PulseAudio
-Exec=pactl load-module module-x11-xsmp
-Terminal=false
-Type=Application
-Categories=
-GenericName=
diff --git a/src/daemon/pulseaudio.desktop b/src/daemon/pulseaudio.desktop
new file mode 100644
index 00000000..57a7a6e4
--- /dev/null
+++ b/src/daemon/pulseaudio.desktop
@@ -0,0 +1,10 @@
+[Desktop Entry]
+Version=1.0
+Encoding=UTF-8
+Name=PulseAudio Sound System
+Comment=Start the PulseAudio Sound System
+Exec=start-pulseaudio-x11
+Terminal=false
+Type=Application
+Categories=
+GenericName=
diff --git a/src/daemon/start-pulseaudio-x11.in b/src/daemon/start-pulseaudio-x11.in
new file mode 100755
index 00000000..3cccc4dc
--- /dev/null
+++ b/src/daemon/start-pulseaudio-x11.in
@@ -0,0 +1,31 @@
+#!/bin/sh
+
+# This file is part of PulseAudio.
+#
+# PulseAudio is free software; you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# PulseAudio is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with PulseAudio; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+# USA.
+
+set -e
+
+@PA_BINARY@ --start "$@"
+
+if [ x"$DISPLAY" != x ] ; then
+
+ @PACTL_BINARY@ load-module module-x11-publish "display=$DISPLAY" > /dev/null
+
+ if [ x"$SESSION_MANAGER" != x ] ; then
+ @PACTL_BINARY@ load-module module-x11-xsmp "display=$DISPLAY session_manager=$SESSION_MANAGER" > /dev/null
+ fi
+fi
diff --git a/src/daemon/system.pa.in b/src/daemon/system.pa.in
new file mode 100755
index 00000000..f6052c4b
--- /dev/null
+++ b/src/daemon/system.pa.in
@@ -0,0 +1,54 @@
+#!@PA_BINARY@ -nF
+#
+# This file is part of PulseAudio.
+#
+# PulseAudio is free software; you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# PulseAudio is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with PulseAudio; if not, write to the Free Software Foundation,
+# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+
+# This startup script is used only if PulseAudio is started in system
+# mode.
+
+### Automatically load driver modules depending on the hardware available
+.ifexists module-hal-detect@PA_SOEXT@
+load-module module-hal-detect
+.else
+### Alternatively use the static hardware detection module (for systems that
+### lack HAL support)
+load-module module-detect
+.endif
+
+### Load several protocols
+.ifexists module-esound-protocol-unix@PA_SOEXT@
+load-module module-esound-protocol-unix
+.endif
+load-module module-native-protocol-unix
+
+### Automatically restore the volume of playback streams
+load-module module-volume-restore
+
+### Automatically restore the default sink/source when changed by the user during runtime
+load-module module-default-device-restore
+
+### Automatically move streams to the default sink if the sink they are
+### connected to dies, similar for sources
+load-module module-rescue-streams
+
+### Make sure we always have a sink around, even if it is a null sink.
+load-module module-always-sink
+
+### Automatically suspend sinks/sources that become idle for too long
+load-module module-suspend-on-idle
+
+### Enable positioned event sounds
+load-module module-position-event-sounds