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

Tanu Kaskinen tanuk at iki.fi
Thu Feb 16 10:09:37 UTC 2017

The first patch refactors the default sink/source handling code to make
it easier to add new conditions to how the default sink and source are
chosen. It's not pure refactoring, though: the patch also fixes some
cases where change notifications were not sent, and the D-Bus protocol's
default sink/source functionality should work much better now, and there
are new log messages for default device changes.

The second patch fixes improves the default sink/source selection by
avoiding devices whose active port is unavailable.

Changes in v3:
 - Fixed a crash in module-dbus-protocol: the module would crash if a
   new sink became immediately the default, because the module assumed
   that the sink put hook would always be fired before the default sink
   changed hook.
 - Changed the default source selection logic so that if we're comparing
   two monitor sources, the monitored sinks are compared before
   resorting to checking whether one of the sources is already the

Changes in v2:
 - Added a note about the D-Bus protocol bug to the first patch's commit
 - Changed the default sink/source selection logic to prefer the current
   default device when comparing two devices with the same priority.
 - Removed the redundant call to pa_core_update_default_sink/source()
   when unlinking the current configured default sink or source.
   pa_core_set_configured_default_sink/source() will call that function
 - Made the comment on pa_core.default_sink/source a bit more verbose.
 - Dropped the patch that uses the active port's priority as the
   sink/source priority. The discussion is ongoing about what to do
   about that, so I'll submit that patch separately later, or a
   different patch that achieves the same goal.

Tanu Kaskinen (2):
  refactor default sink/source handling
  core, device-port: check availability when choosing the default device

 src/modules/dbus/iface-core.c               | 114 +++++++++++------
 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                        | 186 ++++++++++++++++++++++++++++
 src/pulsecore/core.h                        |  28 ++++-
 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                        |   7 ++
 src/pulsecore/source.c                      |   7 ++
 16 files changed, 394 insertions(+), 239 deletions(-)


More information about the pulseaudio-discuss mailing list