From 24bcacc6195ffbf8e40c9ea1374eb6666252eadc Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Tue, 14 Jan 2025 12:34:13 +0100 Subject: [PATCH] conf: remove client-rt.conf We now automatically move non-rt clients into non-rt threads so the client-rt.conf is obsolete. Move the module-rt in client.conf and add conditions to disable modules. Transparently load client.conf in case applications still specify client-rt.conf. Custon configuration in the client-rt.conf.d/ should be moved to client.conf.d/ --- doc/dox/config/pipewire-client.conf.5.md | 19 +-- doc/dox/config/xref.md | 2 +- pipewire-alsa/alsa-plugins/ctl_pipewire.c | 1 - pipewire-alsa/alsa-plugins/pcm_pipewire.c | 1 - .../client-rt.conf.avail/20-upmix.conf.in | 8 -- src/daemon/client-rt.conf.avail/meson.build | 12 -- src/daemon/client-rt.conf.in | 136 ------------------ src/daemon/client.conf.in | 71 ++++++++- src/daemon/meson.build | 2 - src/examples/audio-capture.c | 1 - src/examples/internal.c | 5 +- src/pipewire/conf.c | 4 + src/tools/pw-cat.c | 6 +- 13 files changed, 75 insertions(+), 193 deletions(-) delete mode 100644 src/daemon/client-rt.conf.avail/20-upmix.conf.in delete mode 100644 src/daemon/client-rt.conf.avail/meson.build delete mode 100644 src/daemon/client-rt.conf.in diff --git a/doc/dox/config/pipewire-client.conf.5.md b/doc/dox/config/pipewire-client.conf.5.md index 11a849d3f..66bf3d2ec 100644 --- a/doc/dox/config/pipewire-client.conf.5.md +++ b/doc/dox/config/pipewire-client.conf.5.md @@ -18,18 +18,6 @@ The PipeWire client configuration file. *$XDG_CONFIG_HOME/pipewire/client.conf.d/* -*$XDG_CONFIG_HOME/pipewire/client-rt.conf* - -*$(PIPEWIRE_CONFIG_DIR)/client-rt.conf* - -*$(PIPEWIRE_CONFDATADIR)/client-rt.conf* - -*$(PIPEWIRE_CONFDATADIR)/client-rt.conf.d/* - -*$(PIPEWIRE_CONFIG_DIR)/client-rt.conf.d/* - -*$XDG_CONFIG_HOME/pipewire/client-rt.conf.d/* - # DESCRIPTION Configuration for PipeWire native clients, and for PipeWire's ALSA @@ -38,9 +26,6 @@ plugin. A PipeWire native client program selects the default config to load, and if nothing is specified, it usually loads `client.conf`. -The ALSA plugin uses the `client-rt.conf` file, as do some PipeWire -native clients such as \ref page_man_pw-cat_1 "pw-cat(1)". - The configuration file format and lookup logic is the same as for \ref page_man_pipewire_conf_5 "pipewire.conf(5)". Drop-in configuration files `client.conf.d/*.conf` can be used, and are recommended. @@ -148,7 +133,7 @@ An `alsa.properties` section can be added to configure client applications that connect via the PipeWire ALSA plugin. ```css -# ~/.config/pipewire/client-rt.conf.d/custom.conf +# ~/.config/pipewire/client.conf.d/custom.conf alsa.properties = { #alsa.deny = false @@ -193,7 +178,7 @@ set any of the above ALSA properties or any of the `stream.properties`. ### Example ```css -# ~/.config/pipewire/client-rt.conf.d/custom.conf +# ~/.config/pipewire/client.conf.d/custom.conf alsa.rules = [ { matches = [ { application.process.binary = "resolve" } ] diff --git a/doc/dox/config/xref.md b/doc/dox/config/xref.md index e5652fd85..507d09bf4 100644 --- a/doc/dox/config/xref.md +++ b/doc/dox/config/xref.md @@ -8,7 +8,7 @@ @SECREF@ pipewire-pulse.conf -\ref page_man_pipewire-client_conf_5 "client.conf, client-rt.conf" +\ref page_man_pipewire-client_conf_5 "client.conf" @SECREF@ client.conf diff --git a/pipewire-alsa/alsa-plugins/ctl_pipewire.c b/pipewire-alsa/alsa-plugins/ctl_pipewire.c index 8b3c26adf..7fcfd5726 100644 --- a/pipewire-alsa/alsa-plugins/ctl_pipewire.c +++ b/pipewire-alsa/alsa-plugins/ctl_pipewire.c @@ -1344,7 +1344,6 @@ SND_CTL_PLUGIN_DEFINE_FUNC(pipewire) ctl->context = pw_context_new(loop, pw_properties_new( PW_KEY_CLIENT_API, "alsa", - PW_KEY_CONFIG_NAME, "client-rt.conf", NULL), 0); if (ctl->context == NULL) { diff --git a/pipewire-alsa/alsa-plugins/pcm_pipewire.c b/pipewire-alsa/alsa-plugins/pcm_pipewire.c index c6a8702ef..e51cf1b56 100644 --- a/pipewire-alsa/alsa-plugins/pcm_pipewire.c +++ b/pipewire-alsa/alsa-plugins/pcm_pipewire.c @@ -1288,7 +1288,6 @@ static int snd_pcm_pipewire_open(snd_pcm_t **pcmp, pw->system = loop->system; if ((pw->context = pw_context_new(loop, pw_properties_new( - PW_KEY_CONFIG_NAME, "client-rt.conf", PW_KEY_CLIENT_API, "alsa", NULL), 0)) == NULL) { diff --git a/src/daemon/client-rt.conf.avail/20-upmix.conf.in b/src/daemon/client-rt.conf.avail/20-upmix.conf.in deleted file mode 100644 index 064eba144..000000000 --- a/src/daemon/client-rt.conf.avail/20-upmix.conf.in +++ /dev/null @@ -1,8 +0,0 @@ -# Enables upmixing -stream.properties = { - channelmix.upmix = true - channelmix.upmix-method = psd # none, simple - channelmix.lfe-cutoff = 150 - channelmix.fc-cutoff = 12000 - channelmix.rear-delay = 12.0 -} diff --git a/src/daemon/client-rt.conf.avail/meson.build b/src/daemon/client-rt.conf.avail/meson.build deleted file mode 100644 index a6dc07bbf..000000000 --- a/src/daemon/client-rt.conf.avail/meson.build +++ /dev/null @@ -1,12 +0,0 @@ -conf_files = [ - '20-upmix.conf', -] - -foreach c : conf_files - res = configure_file(input : '@0@.in'.format(c), - output : c, - configuration : conf_config, - install_dir : pipewire_confdatadir / 'client-rt.conf.avail') - test(f'validate-json-client-rt-@c@', spa_json_dump_exe, args : res) -endforeach - diff --git a/src/daemon/client-rt.conf.in b/src/daemon/client-rt.conf.in deleted file mode 100644 index ed08a5f1f..000000000 --- a/src/daemon/client-rt.conf.in +++ /dev/null @@ -1,136 +0,0 @@ -# Real-time Client config file for PipeWire version @VERSION@ # -# -# Copy and edit this file in @PIPEWIRE_CONFIG_DIR@ for system-wide changes -# or in ~/.config/pipewire for local changes. -# -# It is also possible to place a file with an updated section in -# @PIPEWIRE_CONFIG_DIR@/client-rt.conf.d/ for system-wide changes or in -# ~/.config/pipewire/client-rt.conf.d/ for local changes. -# - -context.properties = { - ## Configure properties in the system. - #mem.warn-mlock = false - #mem.allow-mlock = true - #mem.mlock-all = false - log.level = 0 - - #default.clock.quantum-limit = 8192 -} - -context.spa-libs = { - # = - # - # Used to find spa factory names. It maps an spa factory name - # regular expression to a library name that should contain - # that factory. - # - audio.convert.* = audioconvert/libspa-audioconvert - support.* = support/libspa-support -} - -context.modules = [ - #{ name = - # ( args = { = ... } ) - # ( flags = [ ( ifexists ) ( nofail ) ] ) - # ( condition = [ { = ... } ... ] ) - #} - # - # Loads a module with the given parameters. - # If ifexists is given, the module is ignored when it is not found. - # If nofail is given, module initialization failures are ignored. - # - # Uses realtime scheduling to boost the audio thread priorities - { name = libpipewire-module-rt - args = { - #rt.prio = @rtprio_client@ - #rt.time.soft = -1 - #rt.time.hard = -1 - } - flags = [ ifexists nofail ] - } - - # The native communication protocol. - { name = libpipewire-module-protocol-native } - - # Allows creating nodes that run in the context of the - # client. Is used by all clients that want to provide - # data to PipeWire. - { name = libpipewire-module-client-node } - - # Allows creating devices that run in the context of the - # client. Is used by the session manager. - { name = libpipewire-module-client-device } - - # Makes a factory for wrapping nodes in an adapter with a - # converter and resampler. - { name = libpipewire-module-adapter } - - # Allows applications to create metadata objects. It creates - # a factory for Metadata objects. - { name = libpipewire-module-metadata } - - # Provides factories to make session manager objects. - { name = libpipewire-module-session-manager } -] - -filter.properties = { - #node.latency = 1024/48000 -} - -stream.properties = { - #node.latency = 1024/48000 - #node.autoconnect = true - #resample.quality = 4 - #channelmix.normalize = false - #channelmix.mix-lfe = true - #channelmix.upmix = true - #channelmix.upmix-method = psd # none, simple - #channelmix.lfe-cutoff = 150 - #channelmix.fc-cutoff = 12000 - #channelmix.rear-delay = 12.0 - #channelmix.stereo-widen = 0.0 - #channelmix.hilbert-taps = 0 - #dither.noise = 0 -} - -stream.rules = [ - { matches = [ - { - # all keys must match the value. ! negates. ~ starts regex. - #application.name = "pw-cat" - #node.name = "~Google Chrome$" - } - ] - actions = { - update-props = { - #node.latency = 512/48000 - } - } - } -] - -alsa.properties = { - #alsa.deny = false - # ALSA params take a single value, an array [] of values - # or a range { min=.. max=... } - #alsa.access = [ MMAP_INTERLEAVED MMAP_NONINTERLEAVED RW_INTERLEAVED RW_NONINTERLEAVED ] - #alsa.format = [ FLOAT S32 S24 S24_3 S16 U8 ] - #alsa.rate = { min=1 max=384000 } # or [ 44100 48000 .. ] - #alsa.channels = { min=1 max=64 } # or [ 2 4 6 .. ] - #alsa.period-bytes = { min=128 max=2097152 } # or [ 128 256 1024 .. ] - #alsa.buffer-bytes = { min=256 max=4194304 } # or [ 256 512 4096 .. ] - - #alsa.volume-method = cubic # linear, cubic -} - -# client specific properties -alsa.rules = [ - { matches = [ { application.process.binary = "resolve" } ] - actions = { - update-props = { - alsa.buffer-bytes = 131072 - } - } - } -] diff --git a/src/daemon/client.conf.in b/src/daemon/client.conf.in index f23677cf6..46874af93 100644 --- a/src/daemon/client.conf.in +++ b/src/daemon/client.conf.in @@ -41,6 +41,16 @@ context.modules = [ # If ifexists is given, the module is ignored when it is not found. # If nofail is given, module initialization failures are ignored. # + # Uses realtime scheduling to boost the audio thread priorities + { name = libpipewire-module-rt + args = { + #rt.prio = @rtprio_client@ + #rt.time.soft = -1 + #rt.time.hard = -1 + } + flags = [ ifexists nofail ] + condition = [ { module.rt = !false } ] + } # The native communication protocol. { name = libpipewire-module-protocol-native } @@ -48,22 +58,32 @@ context.modules = [ # Allows creating nodes that run in the context of the # client. Is used by all clients that want to provide # data to PipeWire. - { name = libpipewire-module-client-node } + { name = libpipewire-module-client-node + condition = [ { module.client-node = !false } ] + } # Allows creating devices that run in the context of the # client. Is used by the session manager. - { name = libpipewire-module-client-device } + { name = libpipewire-module-client-device + condition = [ { module.client-device = !false } ] + } # Makes a factory for wrapping nodes in an adapter with a # converter and resampler. - { name = libpipewire-module-adapter } + { name = libpipewire-module-adapter + condition = [ { module.adapter = !false } ] + } # Allows applications to create metadata objects. It creates # a factory for Metadata objects. - { name = libpipewire-module-metadata } + { name = libpipewire-module-metadata + condition = [ { module.metadata = !false } ] + } # Provides factories to make session manager objects. - { name = libpipewire-module-session-manager } + { name = libpipewire-module-session-manager + condition = [ { module.session-manager = !false } ] + } ] filter.properties = { @@ -85,3 +105,44 @@ stream.properties = { #channelmix.hilbert-taps = 0 #dither.noise = 0 } + +stream.rules = [ + { matches = [ + { + # all keys must match the value. ! negates. ~ starts regex. + #application.name = "pw-cat" + #node.name = "~Google Chrome$" + } + ] + actions = { + update-props = { + #node.latency = 512/48000 + } + } + } +] + +alsa.properties = { + #alsa.deny = false + # ALSA params take a single value, an array [] of values + # or a range { min=.. max=... } + #alsa.access = [ MMAP_INTERLEAVED MMAP_NONINTERLEAVED RW_INTERLEAVED RW_NONINTERLEAVED ] + #alsa.format = [ FLOAT S32 S24 S24_3 S16 U8 ] + #alsa.rate = { min=1 max=384000 } # or [ 44100 48000 .. ] + #alsa.channels = { min=1 max=64 } # or [ 2 4 6 .. ] + #alsa.period-bytes = { min=128 max=2097152 } # or [ 128 256 1024 .. ] + #alsa.buffer-bytes = { min=256 max=4194304 } # or [ 256 512 4096 .. ] + + #alsa.volume-method = cubic # linear, cubic +} + +# client specific properties +alsa.rules = [ + { matches = [ { application.process.binary = "resolve" } ] + actions = { + update-props = { + alsa.buffer-bytes = 131072 + } + } + } +] diff --git a/src/daemon/meson.build b/src/daemon/meson.build index 6d98f4b53..b2ebb9375 100644 --- a/src/daemon/meson.build +++ b/src/daemon/meson.build @@ -66,7 +66,6 @@ endif conf_files = [ 'pipewire.conf', 'client.conf', - 'client-rt.conf', 'filter-chain.conf', 'jack.conf', 'minimal.conf', @@ -95,7 +94,6 @@ test('validate-json-pipewire-uninstalled.conf', spa_json_dump_exe, args : res) conf_avail_folders = [ 'pipewire.conf.avail', 'client.conf.avail', - 'client-rt.conf.avail', 'pipewire-pulse.conf.avail', ] diff --git a/src/examples/audio-capture.c b/src/examples/audio-capture.c index f6a31dfa6..c44f905f6 100644 --- a/src/examples/audio-capture.c +++ b/src/examples/audio-capture.c @@ -143,7 +143,6 @@ int main(int argc, char *argv[]) * the data. */ props = pw_properties_new(PW_KEY_MEDIA_TYPE, "Audio", - PW_KEY_CONFIG_NAME, "client-rt.conf", PW_KEY_MEDIA_CATEGORY, "Capture", PW_KEY_MEDIA_ROLE, "Music", NULL); diff --git a/src/examples/internal.c b/src/examples/internal.c index 347ad70bf..8b8210ca1 100644 --- a/src/examples/internal.c +++ b/src/examples/internal.c @@ -53,10 +53,7 @@ int main(int argc, char *argv[]) pw_loop_add_signal(pw_main_loop_get_loop(data.loop), SIGINT, do_quit, &data); pw_loop_add_signal(pw_main_loop_get_loop(data.loop), SIGTERM, do_quit, &data); - data.context = pw_context_new(pw_main_loop_get_loop(data.loop), - pw_properties_new( - PW_KEY_CONFIG_NAME, "client-rt.conf", - NULL), 0); + data.context = pw_context_new(pw_main_loop_get_loop(data.loop), NULL, 0); pw_context_load_module(data.context, "libpipewire-module-spa-node-factory", NULL, NULL); pw_context_load_module(data.context, "libpipewire-module-link-factory", NULL, NULL); diff --git a/src/pipewire/conf.c b/src/pipewire/conf.c index e040841e5..387a3ab9e 100644 --- a/src/pipewire/conf.c +++ b/src/pipewire/conf.c @@ -1200,6 +1200,10 @@ int pw_conf_load_conf_for_context(struct pw_properties *props, struct pw_propert conf_name = getenv("PIPEWIRE_CONFIG_NAME"); if ((res = try_load_conf(conf_prefix, conf_name, conf)) < 0) { conf_name = pw_properties_get(props, PW_KEY_CONFIG_NAME); + if (spa_streq(conf_name, "client-rt.conf")) { + pw_log_warn("setting config.name to client-rt.conf is deprecated, using client.conf"); + conf_name = NULL; + } if (conf_name == NULL) conf_name = "client.conf"; else if (!valid_conf_name(conf_name)) { diff --git a/src/tools/pw-cat.c b/src/tools/pw-cat.c index 43669d146..f485a08f1 100644 --- a/src/tools/pw-cat.c +++ b/src/tools/pw-cat.c @@ -1857,11 +1857,7 @@ int main(int argc, char *argv[]) pw_loop_add_signal(l, SIGINT, do_quit, &data); pw_loop_add_signal(l, SIGTERM, do_quit, &data); - data.context = pw_context_new(l, - pw_properties_new( - PW_KEY_CONFIG_NAME, "client-rt.conf", - NULL), - 0); + data.context = pw_context_new(l, NULL, 0); if (!data.context) { fprintf(stderr, "error: pw_context_new() failed: %m\n"); goto error_no_context;