policy-node: make streams follow default sink/src changes

The motivation is to have both existing and new streams that have been
created without explicit target node, to be directed to the same devices
at all times. To achieve this:

Consider what find_node returns as the "default node".

Consider streams that auto+reconnect and don't have an explicit target,
as following default.  In rescan, if the default node has changed,
relink such streams to the new default.

Remove the old code that explicitly moved streams when the default.*
metadata changed, as it implements a similar thing but in a less robust
way (may fail to do what's intended, because the default device
metadata is commonly unset, or the metadata callback comes before
session_create has seen the new nodes).

Enable this feature based on "policy-node.streams-follow-default"
property. Allow setting the property also by loading the
streams-follow-default module. Enable it by default only for the
with-pulseaudio module group.
This commit is contained in:
Pauli Virtanen 2021-01-17 00:31:47 +02:00 committed by Wim Taymans
parent 419d0ad7b6
commit b10123eceb
5 changed files with 103 additions and 52 deletions

View file

@ -30,6 +30,7 @@ modules = {
#default-nodes # restore default nodes
#default-profile # restore default profiles
#default-routes # restore default route
#streams-follow-default # move streams when default changes
#alsa-seq # alsa seq midi support
#alsa-monitor # alsa udev detection
#bluez5 # bluetooth support
@ -53,5 +54,6 @@ modules = {
with-audio
bluez5
restore-stream
streams-follow-default
]
}