Implement before/after dependencies for components
Components are currently loaded in the order that they are "pulled" by their dependencies, starting from the order they appear in the wireplumber.profile
section and then following the order in which they appear in the wireplumber.components
section.
In some cases this is not good enough. As we saw in !617 (merged), the m-standard-event-source module needs to be loaded after all the hooks, otherwise there may be missed events that the hook was supposed to "catch", but they were delivered before the hook was actually loaded. In a similar fashion, we have in purpose put all the "monitor" components at the every end of the array because if we load them earlier, they will create devices and nodes before all the hooks are in place to react.
To solve this, I believe we should follow the same model as in the hooks, using before/after dependencies. Example:
{
name = node/state-stream.lua, type = script/lua
provides = hooks.stream.state
before = support.standard-event-source
}
...
{
name = monitors/alsa.lua, type = script/lua
provides = monitor.alsa
requires = [ support.export-core, pw.client-device ]
wants = [ monitor.alsa.reserve-device ]
after = support.standard-event-source
}
This is also critical for allowing custom user hooks to be loaded without missing the events that are pushed at startup.