conf: support property rules

Add pw_conf_section_update_props_rules() that will not only update the
properties of a section but wil also apply rules in section.rules and
match against the context properties.

Use this by default when using pw_context_conf_update_props().

Add a new method to get a string name of the VM type. Place the
cpu.vm.name in the context properties.

This makes it possible to deprecate the vm.overrides with something more
flexible based on rules. Update the conf files and docs to refect this.
This commit is contained in:
Wim Taymans 2024-03-15 11:55:18 +01:00
parent afd0affd97
commit 7e9e261fa6
12 changed files with 178 additions and 41 deletions

View file

@ -40,11 +40,6 @@ context.properties = {
#
settings.check-quantum = true
settings.check-rate = true
#
# These overrides are only applied when running in a vm.
vm.overrides = {
default.clock.min-quantum = 1024
}
# This config can use udev or hardcoded ALSA devices. Make sure to
# change the alsa device below when disabling udev
@ -54,6 +49,17 @@ context.properties = {
minimal.use-pulse = true
}
context.properties.rules = [
{ matches = [ { cpu.vm.name = !null } ]
actions = {
update-props = {
# These overrides are only applied when running in a vm.
default.clock.min-quantum = 1024
}
}
}
}
context.spa-libs = {
#<factory-name regex> = <library-name>
#

View file

@ -67,7 +67,14 @@ avb.properties = {
# the addresses this server listens on
#ifname = "eth0.2"
ifname = "enp3s0"
# These overrides are only applied when running in a vm.
vm.overrides = {
}
avb.properties.rules = [
{ matches = [ { cpu.vm.name = !null } ]
actions = {
update-props = {
# These overrides are only applied when running in a vm.
}
}
}
}

View file

@ -110,12 +110,19 @@ pulse.properties = {
#pulse.idle.timeout = 0 # don't pause after underruns
#pulse.default.format = F32
#pulse.default.position = [ FL FR ]
# These overrides are only applied when running in a vm.
vm.overrides = {
pulse.min.quantum = 1024/48000 # 22ms
}
}
pulse.properties.rules = [
{ matches = [ { cpu.vm.name = !null } ]
actions = {
update-props = {
# These overrides are only applied when running in a vm.
pulse.min.quantum = 1024/48000 # 22ms
}
}
}
]
# client/stream specific properties
pulse.rules = [
{

View file

@ -40,11 +40,6 @@ context.properties = {
#
#settings.check-quantum = false
#settings.check-rate = false
#
# These overrides are only applied when running in a vm.
vm.overrides = {
default.clock.min-quantum = 1024
}
# keys checked below to disable module loading
module.x11.bell = true
@ -55,6 +50,17 @@ context.properties = {
module.jackdbus-detect = true
}
context.properties.rules = [
{ matches = [ { cpu.vm.name = !null } ]
actions = {
update-props = {
# These overrides are only applied when running in a vm.
default.clock.min-quantum = 1024
}
}
}
}
context.spa-libs = {
#<factory-name regex> = <library-name>
#