media-session: fix linking nodes with targets to wrong nodes
media-session: simplify target node handling + fix priorities
Handle all node.target behavior in rescan_node.
Make distinction between target nodes set in session manager via metadata or via restore-stream; priorities are metadata > client's node.target > restore-stream. Allow metadata override to also remove the target node setting.
media-session: fix linking nodes with targets to wrong nodes
For nodes that have node.target set, when the target is not available, media-session links them to any available node. If the target node appears afterward, media-session would not re-link them, leading to output being directed to wrong place (e.g. pavucontrol input monitor) even though the intended target or a better fallback is available.
This occurs e.g. when devices are removed and re-added.
Fix this by (i) for reconnectable nodes, reconnect them if target appears later, and (ii) for non-reconnectable nodes, raise error to the client if node.target is set but not found (but proceed to fallback if obj->target_node is set).
Also slightly reorganize policy-node.c:rescan_node for clarity.
pulse-server: allow moving nodes with node.target to default sink/src
Set node.target metadata to "-1" instead of deleting it to direct nodes to the default device.
Deleting the metadata, as done previously, does not work for nodes for which the client has node.target set.