wireplumber.conf: add systemwide, embedded and split-instance profiles

Revamp the profiles section, making use of the inherits feature
and add commonly used profiles for systemwide & embedded use cases,
as well as profiles for a split-instance configuration where the
policy hooks run in a separate instance from the alsa, bluetooth
and camera monitors (which run in 3 separate instances respectively)

Also add an example on how to configure the loaded profile using
a config file instead of the CLI switch.

Fixes: #608
This commit is contained in:
George Kiagiadakis 2024-09-03 11:32:54 +03:00
parent a061018150
commit 43ea3db02c
3 changed files with 90 additions and 11 deletions

View file

@ -942,6 +942,8 @@ wp_internal_comp_loader_load (WpComponentLoader * self, WpCore * core,
g_autoptr (GError) error = NULL;
const gchar *profile_name = component;
wp_notice ("Loading profile '%s'", profile_name);
all_profiles_j = wp_conf_get_section (conf, "wireplumber.profiles");
if (!parse_profile_description (profile, all_profiles_j, profile_name,

View file

@ -57,6 +57,7 @@ context.modules = [
wireplumber.profiles = {
## Syntax:
## <profile> = {
## inherits = [ other, profile, names ] # optional
## # optional is the default
## <feature name> = [ required | optional | disabled ]
## ...
@ -64,29 +65,94 @@ wireplumber.profiles = {
# The default profile
main = {
check.no-media-session = required
inherits = [ base ]
metadata.sm-settings = required
support.settings = required
support.log-settings = required
metadata.sm-objects = required
policy.standard = required
hardware.audio = required
hardware.bluetooth = required
hardware.video-capture = required
policy.standard = required
}
# Profile for running on a systemwide level
main-systemwide = {
inherits = [ main, mixin.systemwide-session ]
}
# Typical profile for embedded use cases, systemwide without maintaining state
main-embedded = {
inherits = [ main, mixin.systemwide-session, mixin.stateless ]
}
# Profile for video-only use cases (camera & screen sharing)
video-only = {
check.no-media-session = required
metadata.sm-settings = required
support.settings = required
support.log-settings = required
metadata.sm-objects = required
inherits = [ main ]
hardware.audio = disabled
hardware.bluetooth = disabled
hardware.video-capture = required
}
##
## Profiles for multi-instance setup
##
policy = {
inherits = [ base ]
metadata.sm-settings = required
metadata.sm-objects = required
policy.standard = required
}
audio = {
inherits = [ base ]
hardware.audio = required
}
bluetooth = {
inherits = [ base ]
hardware.bluetooth = required
}
video-capture = {
inherits = [ base ]
hardware.video-capture = required
}
##
## The following are not complete profiles, but blocks that can be inherited
##
# The bare minimum that all instances should have by default
base = {
check.no-media-session = required
support.settings = required
support.log-settings = required
}
# Disable features that are meant only for user sessions
mixin.systemwide-session = {
support.reserve-device = disabled
monitor.alsa.reserve-device = disabled
support.portal-permissionstore = disabled
script.client.access-portal = disabled
support.logind = disabled
monitor.bluez.seat-monitoring = disabled
}
# Disable storing/restoring runtime state information regarding
# default nodes selection, profiles, routes and stream volume / properties
# This makes sense for embedded systems that should always reboot to a default
# state, not remembering any of the user's runtime changes
mixin.stateless = {
hooks.device.profile.state = disabled
hooks.device.routes.state = disabled
hooks.default-nodes.state = disabled
hooks.stream.state = disabled
}
}
wireplumber.components = [
@ -167,7 +233,9 @@ wireplumber.components = [
}
## Activates a global WpSettings instance, providing settings from
## the sm-settings metadata object
## the sm-settings metadata object. Note that this blocks and waits for the
## sm-settings metadata object to become available, so one instance must
## provide that, while others should only load this to access settings
{
name = settings-instance, type = built-in
arguments = { metadata.name = sm-settings }

View file

@ -0,0 +1,9 @@
# This example configuration fragment shows how to permanently instruct
# WirePlumber to load with a specific profile. Note that this overrides the
# `-p, --profile` command line switch, rendering it useless. If you intend to
# run WirePlumber with multiple profiles based on its command line arguments,
# do not use this
context.properties = {
wireplumber.profile = main-embedded
}