Draft: default nodes module fix for disabled nodes

Julian Bouzas requested to merge julian/wireplumber:disabled-nodes-fix into master

Currently, if a user disables a node in 50-alsa-config.lua with the following property:

["node.disabled"] = "true"

The default nodes module will never find a default node, not allowing capture or playback to work at all in wireplumber.

This is because the default nodes module always waits for all the device nodes to be created, avoiding audio glitches when changing the default node and device profile quickly (eg Gnome Sound Settings). If a node has been disabled, the default nodes module will wait forever because the disable node is never activated, leading to wireplumber not being able to play or capture anything because it thinks the nodes are not ready.

To fix this issue, the nodes_ready() function from the default nodes module has been improved to ignore disabled nodes, so the following changes have been made:

  • The nodes are always created and stored in the managed objects list of the parent spa device, even if the node is disabled. The only difference with a disabled node is that it is never activated (never bound to pipewire).
  • Similar to session items, the spa devices can be registered now so that they can be accessed anywhere in wireplumber, and they are automatically registered or removed when they are stored/removed in the managed objects list of the parent spa device.
  • The default nodes module has another object manager that listens for spa devices. When the nodes_ready() function wants to check if there is a disabled node for a device, it gets the associated spa device, and counts all nodes that has the "node.disable" property set to true, which is later used to determine if all the nodes of a device are ready or not.

Fixes #279 (closed)

PS: is it really worth doing all of this instead of just removing the nodes_ready() function and live with the audio glitch which only happens with Gnome Sound Settings?

Edited by Julian Bouzas

Merge request reports