[pulseaudio-discuss] Multi Workstation Single Home Directory NFS Mount

2016-09-08 Thread rjs
Hi,
First off, I am running on RedHat 6, not under my control, so I have pulse
0.9.22.
I am running in normal user mode and everything is generally fine.
The issue is that we have multiple workstations and my user account is
NFS mounted across all workstations in the same directory.
If I have pulse running on one, then I get on another workstation and get
pulse running, the first, and eventually the second go out to lunch.
No applications can connect, pacmd returns:
"No PulseAudio daemon running, etc."
In addition, I believe the pulseaudio process stops and restarts every 5
seconds, generating many /tmp/pulse- directories.
By the way, the PID of the pulse instance, on each machine, is contained in
one of those directories, as I expect.
The only way to be able to connect again is to logout on one of the
workstations,
kill pulseaudio, delete all of the /tmp/pulse-... directories, then restart.
Due to our environment, there is no way to avoid this configuration and most
likely cannot update our pulse version.
Is running pulseaudio in system-wide mode an option to solve this?
Thanks,
Bob
___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


[pulseaudio-discuss] [PATCH] daemon-conf: enable memfd by default

2016-09-08 Thread Tanu Kaskinen
memfd support was introduced in 9.0, but disabled by default. No issues
have been reported - now is a good time to enable it by default.
---
 man/pulse-daemon.conf.5.xml.in | 2 +-
 src/daemon/daemon-conf.c   | 2 +-
 src/daemon/daemon.conf.in  | 1 +
 3 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/man/pulse-daemon.conf.5.xml.in b/man/pulse-daemon.conf.5.xml.in
index ed77158..ff5a293 100644
--- a/man/pulse-daemon.conf.5.xml.in
+++ b/man/pulse-daemon.conf.5.xml.in
@@ -196,7 +196,7 @@ License along with PulseAudio; if not, see 
.
 
 
   enable-memfd=. Enable memfd shared memory. Takes
-  a boolean argument, defaults to no.
+  a boolean argument, defaults to yes.
 
 
 
diff --git a/src/daemon/daemon-conf.c b/src/daemon/daemon-conf.c
index 4277301..f0ed0b4 100644
--- a/src/daemon/daemon-conf.c
+++ b/src/daemon/daemon-conf.c
@@ -92,7 +92,7 @@ static const pa_daemon_conf default_conf = {
 #endif
 .no_cpu_limit = true,
 .disable_shm = false,
-.disable_memfd = true,
+.disable_memfd = false,
 .lock_memory = false,
 .deferred_volume = true,
 .default_n_fragments = 4,
diff --git a/src/daemon/daemon.conf.in b/src/daemon/daemon.conf.in
index fcc9cb9..f3a1cc3 100644
--- a/src/daemon/daemon.conf.in
+++ b/src/daemon/daemon.conf.in
@@ -28,6 +28,7 @@ ifelse(@HAVE_DBUS@, 1, [dnl
 ; local-server-type = user
 ])dnl
 ; enable-shm = yes
+; enable-memfd = yes
 ; shm-size-bytes = 0 # setting this 0 will use the system-default, usually 64 
MiB
 ; lock-memory = no
 ; cpu-limit = no
-- 
2.9.3

___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] [PATCH 2/3] core, device-port: check availability when choosing the default device

2016-09-08 Thread Tanu Kaskinen
On Thu, 2016-09-08 at 17:06 +0500, Alexander E. Patrakov wrote:
> 08.09.2016 16:06, Tanu Kaskinen wrote:
> > 
> > It doesn't make sense to use a sink or source whose active port is
> > unavailable, so let's take this into account when choosing the default
> > sink and source.
> 
> What happens if there is exactly one sink (e.g. desktop with just one 
> sound card that has line output), and its active port becomes unavailable?

It will be chosen as the default sink.

-- 
Tanu
___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] [PATCH 2/3] core, device-port: check availability when choosing the default device

2016-09-08 Thread Alexander E. Patrakov

08.09.2016 16:06, Tanu Kaskinen wrote:

It doesn't make sense to use a sink or source whose active port is
unavailable, so let's take this into account when choosing the default
sink and source.


What happens if there is exactly one sink (e.g. desktop with just one 
sound card that has line output), and its active port becomes unavailable?


--
Alexander E. Patrakov
___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


[pulseaudio-discuss] [PATCH 1/3] refactor default sink/source handling

2016-09-08 Thread Tanu Kaskinen
Currently the default sink policy is simple: either the user has
configured it explicitly, in which case we always use that as the
default, or we pick the sink with the highest priority. The sink
priorities are currently static, so there's no need to worry about
updating the default sink when sink priorities change.

I intend to make things a bit more complex: if the active port of a sink
is unavailable, the sink should not be the default sink, and I also want
to make sink priorities dependent on the active port, so changing the
port should cause re-evaluation of which sink to choose as the default.
Currently the default sink choice is done only when someone calls
pa_namereg_get_default_sink(), and change notifications are only sent
when a sink is created or destroyed. That makes it hard to add new rules
to the default sink selection policy.

This patch moves the default sink selection to
pa_core_update_default_sink(), which is called whenever something
happens that can affect the default sink choice. That function needs to
know the previous choice in order to send change notifications as
appropriate, but previously pa_core.default_sink was only set when the
user had configured it explicitly. Now pa_core.default_sink is always
set (unless there are no sinks at all), so pa_core_update_default_sink()
can use that to get the previous choice. The user configuration is saved
in a new variable, pa_core.configured_default_sink.

pa_namereg_get_default_sink() is now unnecessary, because
pa_core.default_sink can be used directly to get the
currently-considered-best sink. pa_namereg_set_default_sink() is
replaced by pa_core_set_configured_default_sink().
---
 src/modules/dbus/iface-core.c   |   8 +-
 src/modules/dbus/iface-sample.c |  10 +-
 src/modules/module-default-device-restore.c |  14 ++-
 src/modules/module-intended-roles.c |  37 ---
 src/modules/module-rescue-streams.c |  20 ++--
 src/modules/module-switch-on-connect.c  |  30 +++---
 src/pulsecore/cli-command.c |  20 ++--
 src/pulsecore/cli-text.c|  12 +--
 src/pulsecore/core.c| 155 
 src/pulsecore/core.h|  25 -
 src/pulsecore/namereg.c | 115 ++---
 src/pulsecore/namereg.h |   6 --
 src/pulsecore/protocol-native.c |  19 ++--
 src/pulsecore/sink.c|   7 ++
 src/pulsecore/source.c  |   7 ++
 15 files changed, 278 insertions(+), 207 deletions(-)

diff --git a/src/modules/dbus/iface-core.c b/src/modules/dbus/iface-core.c
index 508913d..a273599 100644
--- a/src/modules/dbus/iface-core.c
+++ b/src/modules/dbus/iface-core.c
@@ -721,7 +721,7 @@ static void handle_set_fallback_sink(DBusConnection *conn, 
DBusMessage *msg, DBu
 return;
 }
 
-pa_namereg_set_default_sink(c->core, 
pa_dbusiface_device_get_sink(fallback_sink));
+pa_core_set_configured_default_sink(c->core, 
pa_dbusiface_device_get_sink(fallback_sink));
 
 pa_dbus_send_empty_reply(conn, msg);
 }
@@ -809,7 +809,7 @@ static void handle_set_fallback_source(DBusConnection 
*conn, DBusMessage *msg, D
 return;
 }
 
-pa_namereg_set_default_source(c->core, 
pa_dbusiface_device_get_source(fallback_source));
+pa_core_set_configured_default_source(c->core, 
pa_dbusiface_device_get_source(fallback_source));
 
 pa_dbus_send_empty_reply(conn, msg);
 }
@@ -2158,8 +2158,8 @@ pa_dbusiface_core *pa_dbusiface_core_new(pa_core *core) {
 c->samples = pa_hashmap_new_full(pa_idxset_trivial_hash_func, 
pa_idxset_trivial_compare_func, NULL, (pa_free_cb_t) pa_dbusiface_sample_free);
 c->modules = pa_hashmap_new_full(pa_idxset_trivial_hash_func, 
pa_idxset_trivial_compare_func, NULL, (pa_free_cb_t) pa_dbusiface_module_free);
 c->clients = pa_hashmap_new_full(pa_idxset_trivial_hash_func, 
pa_idxset_trivial_compare_func, NULL, (pa_free_cb_t) pa_dbusiface_client_free);
-c->fallback_sink = pa_namereg_get_default_sink(core);
-c->fallback_source = pa_namereg_get_default_source(core);
+c->fallback_sink = core->default_sink;
+c->fallback_source = core->default_source;
 c->default_sink_changed_slot = 
pa_hook_connect(>hooks[PA_CORE_HOOK_DEFAULT_SINK_CHANGED],
PA_HOOK_NORMAL, 
default_sink_changed_cb, c);
 c->default_source_changed_slot = 
pa_hook_connect(>hooks[PA_CORE_HOOK_DEFAULT_SOURCE_CHANGED],
diff --git a/src/modules/dbus/iface-sample.c b/src/modules/dbus/iface-sample.c
index 61f2ba0..5118919 100644
--- a/src/modules/dbus/iface-sample.c
+++ b/src/modules/dbus/iface-sample.c
@@ -352,7 +352,6 @@ static void handle_play(DBusConnection *conn, DBusMessage 
*msg, void *userdata)
 DBusMessageIter msg_iter;
 dbus_uint32_t volume = 0;
 pa_proplist *property_list = NULL;
-pa_sink *sink = NULL;
 
 pa_assert(conn);
 

[pulseaudio-discuss] [PATCH 2/3] core, device-port: check availability when choosing the default device

2016-09-08 Thread Tanu Kaskinen
It doesn't make sense to use a sink or source whose active port is
unavailable, so let's take this into account when choosing the default
sink and source.
---
 src/pulsecore/core.c| 16 
 src/pulsecore/device-port.c |  8 
 2 files changed, 24 insertions(+)

diff --git a/src/pulsecore/core.c b/src/pulsecore/core.c
index 7902eec..93a4201 100644
--- a/src/pulsecore/core.c
+++ b/src/pulsecore/core.c
@@ -265,6 +265,14 @@ static int compare_sinks(pa_sink *a, pa_sink *b) {
 
 core = a->core;
 
+/* Available sinks always beat unavailable sinks. */
+if (a->active_port && a->active_port->available == PA_AVAILABLE_NO
+&& (!b->active_port || b->active_port->available != 
PA_AVAILABLE_NO))
+return -1;
+if (b->active_port && b->active_port->available == PA_AVAILABLE_NO
+&& (!a->active_port || a->active_port->available != 
PA_AVAILABLE_NO))
+return 1;
+
 /* The configured default sink is preferred over any other sink. */
 if (b == core->configured_default_sink)
 return -1;
@@ -323,6 +331,14 @@ static int compare_sources(pa_source *a, pa_source *b) {
 
 core = a->core;
 
+/* Available sources always beat unavailable sources. */
+if (a->active_port && a->active_port->available == PA_AVAILABLE_NO
+&& (!b->active_port || b->active_port->available != 
PA_AVAILABLE_NO))
+return -1;
+if (b->active_port && b->active_port->available == PA_AVAILABLE_NO
+&& (!a->active_port || a->active_port->available != 
PA_AVAILABLE_NO))
+return 1;
+
 /* The configured default source is preferred over any other source. */
 if (b == core->configured_default_source)
 return -1;
diff --git a/src/pulsecore/device-port.c b/src/pulsecore/device-port.c
index 7c9ddf3..76a7e80 100644
--- a/src/pulsecore/device-port.c
+++ b/src/pulsecore/device-port.c
@@ -93,6 +93,14 @@ void pa_device_port_set_available(pa_device_port *p, 
pa_available_t status) {
  * be created before port objects, and then p->card could be non-NULL for
  * the whole lifecycle of pa_device_port. */
 if (p->card) {
+/* A sink or source whose active port is unavailable can't be the
+ * default sink/source, so port availability changes may affect the
+ * default sink/source choice. */
+if (p->direction == PA_DIRECTION_OUTPUT)
+pa_core_update_default_sink(p->core);
+else
+pa_core_update_default_source(p->core);
+
 pa_subscription_post(p->core, 
PA_SUBSCRIPTION_EVENT_CARD|PA_SUBSCRIPTION_EVENT_CHANGE, p->card->index);
 pa_hook_fire(>core->hooks[PA_CORE_HOOK_PORT_AVAILABLE_CHANGED], p);
 }
-- 
2.9.3

___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


[pulseaudio-discuss] [PATCH 0/3] Improve default device policy

2016-09-08 Thread Tanu Kaskinen
These patches modify the default sink/source selection policy so that
unavailable devices are avoided, and the active port of a device affects
the priority of the device. This should partially fix bug 93006[1].

[1] https://bugs.freedesktop.org/show_bug.cgi?id=93006

Tanu Kaskinen (3):
  refactor default sink/source handling
  core, device-port: check availability when choosing the default device
  sink, source: copy priority from active port

 src/modules/dbus/iface-core.c   |   8 +-
 src/modules/dbus/iface-sample.c |  10 +-
 src/modules/module-default-device-restore.c |  14 +--
 src/modules/module-intended-roles.c |  37 +++---
 src/modules/module-rescue-streams.c |  20 ++--
 src/modules/module-switch-on-connect.c  |  30 ++---
 src/pulsecore/cli-command.c |  20 ++--
 src/pulsecore/cli-text.c|  12 +-
 src/pulsecore/core.c| 171 
 src/pulsecore/core.h|  25 +++-
 src/pulsecore/device-port.c |   8 ++
 src/pulsecore/namereg.c | 115 +--
 src/pulsecore/namereg.h |   6 -
 src/pulsecore/protocol-native.c |  19 ++--
 src/pulsecore/sink.c|  25 +++-
 src/pulsecore/source.c  |  26 -
 16 files changed, 327 insertions(+), 219 deletions(-)

-- 
2.9.3

___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


[pulseaudio-discuss] [PATCH 3/3] sink, source: copy priority from active port

2016-09-08 Thread Tanu Kaskinen
It was reported in bug 93006 that on hardware that has HDMI and analog
outputs on different cards, the HDMI sink is chosen by default even when
headphones are plugged in. The headphone port has higher priority than
the HDMI port, but that is not reflected in the sink priorities. This
patch changes that - the sink/source priority is now the same as the
active port priority, unless the sink/source doesn't have any ports, in
which case the old priority logic is retained.

BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=93006
---
 src/pulsecore/sink.c   | 18 --
 src/pulsecore/source.c | 19 +--
 2 files changed, 25 insertions(+), 12 deletions(-)

diff --git a/src/pulsecore/sink.c b/src/pulsecore/sink.c
index 9b6e46b..aba11aa 100644
--- a/src/pulsecore/sink.c
+++ b/src/pulsecore/sink.c
@@ -251,7 +251,6 @@ pa_sink* pa_sink_new(
 s->core = core;
 s->state = PA_SINK_INIT;
 s->flags = flags;
-s->priority = 0;
 s->suspend_cause = data->suspend_cause;
 pa_sink_set_mixer_dirty(s, false);
 s->name = pa_xstrdup(name);
@@ -259,9 +258,6 @@ pa_sink* pa_sink_new(
 s->driver = pa_xstrdup(pa_path_get_filename(data->driver));
 s->module = data->module;
 s->card = data->card;
-
-s->priority = pa_device_init_priority(s->proplist);
-
 s->sample_spec = data->sample_spec;
 s->channel_map = data->channel_map;
 s->default_sample_rate = s->sample_spec.rate;
@@ -309,10 +305,13 @@ pa_sink* pa_sink_new(
 if (!s->active_port)
 s->active_port = pa_device_port_find_best(s->ports);
 
-if (s->active_port)
+if (s->active_port) {
+s->priority = s->active_port->priority;
 s->port_latency_offset = s->active_port->latency_offset;
-else
+} else {
+s->priority = pa_device_init_priority(s->proplist);
 s->port_latency_offset = 0;
+}
 
 s->save_volume = data->save_volume;
 s->save_muted = data->save_muted;
@@ -3375,6 +3374,13 @@ int pa_sink_set_port(pa_sink *s, const char *name, bool 
save) {
 s->active_port = port;
 s->save_port = save;
 
+if (port->priority != s->priority) {
+pa_log_info("%s: priority: %u -> %u", s->name, s->priority, 
port->priority);
+s->priority = port->priority;
+
+pa_core_update_default_sink(s->core);
+}
+
 pa_sink_set_port_latency_offset(s, s->active_port->latency_offset);
 
 pa_hook_fire(>core->hooks[PA_CORE_HOOK_SINK_PORT_CHANGED], s);
diff --git a/src/pulsecore/source.c b/src/pulsecore/source.c
index 6292e28..5dae761 100644
--- a/src/pulsecore/source.c
+++ b/src/pulsecore/source.c
@@ -238,7 +238,6 @@ pa_source* pa_source_new(
 s->core = core;
 s->state = PA_SOURCE_INIT;
 s->flags = flags;
-s->priority = 0;
 s->suspend_cause = data->suspend_cause;
 pa_source_set_mixer_dirty(s, false);
 s->name = pa_xstrdup(name);
@@ -246,9 +245,6 @@ pa_source* pa_source_new(
 s->driver = pa_xstrdup(pa_path_get_filename(data->driver));
 s->module = data->module;
 s->card = data->card;
-
-s->priority = pa_device_init_priority(s->proplist);
-
 s->sample_spec = data->sample_spec;
 s->channel_map = data->channel_map;
 s->default_sample_rate = s->sample_spec.rate;
@@ -297,10 +293,13 @@ pa_source* pa_source_new(
 if (!s->active_port)
 s->active_port = pa_device_port_find_best(s->ports);
 
-if (s->active_port)
+if (s->active_port) {
+s->priority = s->active_port->priority;
 s->port_latency_offset = s->active_port->latency_offset;
-else
+} else {
+s->priority = pa_device_init_priority(s->proplist);
 s->port_latency_offset = 0;
+}
 
 s->save_volume = data->save_volume;
 s->save_muted = data->save_muted;
@@ -2644,6 +2643,14 @@ int pa_source_set_port(pa_source *s, const char *name, 
bool save) {
 s->active_port = port;
 s->save_port = save;
 
+if (port->priority != s->priority) {
+pa_log_info("%s: priority: %u -> %u", s->name, s->priority, 
port->priority);
+s->priority = port->priority;
+
+/* The source priority may affect the default source choice. */
+pa_core_update_default_source(s->core);
+}
+
 pa_source_set_port_latency_offset(s, s->active_port->latency_offset);
 
 pa_hook_fire(>core->hooks[PA_CORE_HOOK_SOURCE_PORT_CHANGED], s);
-- 
2.9.3

___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss