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 v2: - Added a note about the D-Bus protocol bug to the first patch's commit message. - 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 anyway. - 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 | 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 | 187 ++++++++++++++++++++++++++++ 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, 321 insertions(+), 207 deletions(-) -- 2.11.0