From ecd1d3e1d7950316778fe40b926bf64cd85fb725 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Mon, 8 Feb 2021 17:19:47 +0100 Subject: [PATCH] Move node.pause-on-idle setting to config files So that we can configure it. Add some more docs to the config file --- spa/plugins/alsa/alsa-pcm-sink.c | 1 - spa/plugins/alsa/alsa-pcm-source.c | 1 - spa/plugins/bluez5/a2dp-sink.c | 1 - spa/plugins/bluez5/a2dp-source.c | 1 - spa/plugins/v4l2/v4l2-source.c | 1 - src/daemon/media-session.d/alsa-monitor.conf | 51 ++++++++-- src/daemon/media-session.d/bluez-monitor.conf | 2 +- src/daemon/media-session.d/v4l2-monitor.conf | 2 +- src/daemon/pipewire.conf.in | 96 ++++++++++++++----- 9 files changed, 114 insertions(+), 42 deletions(-) diff --git a/spa/plugins/alsa/alsa-pcm-sink.c b/spa/plugins/alsa/alsa-pcm-sink.c index d75c4a6ec..9626c38c2 100644 --- a/spa/plugins/alsa/alsa-pcm-sink.c +++ b/spa/plugins/alsa/alsa-pcm-sink.c @@ -273,7 +273,6 @@ static const struct spa_dict_item node_info_items[] = { { SPA_KEY_DEVICE_API, "alsa" }, { SPA_KEY_MEDIA_CLASS, "Audio/Sink" }, { SPA_KEY_NODE_DRIVER, "true" }, - { SPA_KEY_NODE_PAUSE_ON_IDLE, "false" }, }; static void emit_node_info(struct state *this, bool full) diff --git a/spa/plugins/alsa/alsa-pcm-source.c b/spa/plugins/alsa/alsa-pcm-source.c index 17b12e789..3ed2fb0f4 100644 --- a/spa/plugins/alsa/alsa-pcm-source.c +++ b/spa/plugins/alsa/alsa-pcm-source.c @@ -275,7 +275,6 @@ static const struct spa_dict_item node_info_items[] = { { SPA_KEY_DEVICE_API, "alsa" }, { SPA_KEY_MEDIA_CLASS, "Audio/Source" }, { SPA_KEY_NODE_DRIVER, "true" }, - { SPA_KEY_NODE_PAUSE_ON_IDLE, "false" }, }; static void emit_node_info(struct state *this, bool full) diff --git a/spa/plugins/bluez5/a2dp-sink.c b/spa/plugins/bluez5/a2dp-sink.c index 291fdcfe7..92c09af3b 100644 --- a/spa/plugins/bluez5/a2dp-sink.c +++ b/spa/plugins/bluez5/a2dp-sink.c @@ -823,7 +823,6 @@ static const struct spa_dict_item node_info_items[] = { { SPA_KEY_MEDIA_CLASS, "Audio/Sink" }, { SPA_KEY_NODE_DRIVER, "true" }, { SPA_KEY_NODE_LATENCY, SPA_STRINGIFY(MIN_LATENCY)"/48000" }, - { SPA_KEY_NODE_PAUSE_ON_IDLE, "false" }, }; static void emit_node_info(struct impl *this, bool full) diff --git a/spa/plugins/bluez5/a2dp-source.c b/spa/plugins/bluez5/a2dp-source.c index b5f3c9d24..86e4d0fa1 100644 --- a/spa/plugins/bluez5/a2dp-source.c +++ b/spa/plugins/bluez5/a2dp-source.c @@ -704,7 +704,6 @@ static void emit_node_info(struct impl *this, bool full) { SPA_KEY_DEVICE_API, "bluez5" }, { SPA_KEY_MEDIA_CLASS, "Stream/Output/Audio" }, { SPA_KEY_NODE_LATENCY, SPA_STRINGIFY(MIN_LATENCY)"/48000" }, - { SPA_KEY_NODE_PAUSE_ON_IDLE, "false" }, { "media.name", ((this->transport && this->transport->device->name) ? this->transport->device->name : "A2DP") }, }; diff --git a/spa/plugins/v4l2/v4l2-source.c b/spa/plugins/v4l2/v4l2-source.c index 87acb6f2d..96e2d5f8b 100644 --- a/spa/plugins/v4l2/v4l2-source.c +++ b/spa/plugins/v4l2/v4l2-source.c @@ -323,7 +323,6 @@ static const struct spa_dict_item info_items[] = { { SPA_KEY_DEVICE_API, "v4l2" }, { SPA_KEY_MEDIA_CLASS, "Video/Source" }, { SPA_KEY_MEDIA_ROLE, "Camera" }, - { SPA_KEY_NODE_PAUSE_ON_IDLE, "false" }, { SPA_KEY_NODE_DRIVER, "true" }, }; diff --git a/src/daemon/media-session.d/alsa-monitor.conf b/src/daemon/media-session.d/alsa-monitor.conf index c77a76c2b..0f6d40514 100644 --- a/src/daemon/media-session.d/alsa-monitor.conf +++ b/src/daemon/media-session.d/alsa-monitor.conf @@ -1,5 +1,6 @@ # alsa-monitor config file properties = { + # Create a JACK device #alsa.jack-device = true } @@ -11,21 +12,52 @@ rules = [ # matches work, the actions are executed for the object. matches = [ { - # this matches all cards + # this matches all cards. These are regular expressions + # so "." matches one character and ".*" matches many. device.name = "~alsa_card.*" } ] actions = { # actions can update properties on the matched object. update-props = { + # Use ALSA-Card-Profile devices. They use UCM or + # the profile configuration to configure the device + # and mixer settings. api.alsa.use-acp = true + + # Use UCM instead of profile when available. Can be + # disabled to skip trying to use the UCM profile #api.alsa.use-ucm = true + + # Don't use the hardware mixer for volume control. It + # will only use software volume. The mixer is still used + # to mute unused paths based on the selected port #api.alsa.soft-mixer = false + + # Ignore Decibel settings of the driver. Can be used to + # work around buggy drivers that report wrong values #api.alsa.ignore-dB = false + + # The profile set to use for the device. Usually this + # "default.conf" but can be changed with a udev rule + # or here. #device.profile-set = "profileset-name" + + # The default active profile. Is by defaul set to "Off" #device.profile = "default profile name" - api.acp.auto-profile = false - api.acp.auto-port = false + + # Automatically select the best profile. This is the + # highest priority available profile. This is disabled + # here and instead implemented in the session manager + # where it can save and load previous preferences + api.acp.auto-profile = false + + # Automatically switch to the highest priority available + # port. This is disabled here and implemented in the + # session manager instead. + api.acp.auto-port = false + + # Other properties can be set here #device.nick = "My Device" } } @@ -33,7 +65,8 @@ rules = [ { matches = [ { - # matches all sinks + # matches all sinks. These are regular expressions + # so "." matches one character and ".*" matches many. node.name = "~alsa_input.*" } { @@ -47,7 +80,7 @@ rules = [ #node.nick = null #priority.driver = 100 #priority.session = 100 - #node.pause-on-idle = false + node.pause-on-idle = false #resample.quality = 4 #channelmix.normalize = false #channelmix.mix-lfe = false @@ -55,10 +88,10 @@ rules = [ #audio.format = "S16LE" #audio.rate = 44100 #audio.position = "FL,FR" - #api.alsa.period-size = 1024 - #api.alsa.headroom = 0 - #api.alsa.disable-mmap = false - #api.alsa.disable-batch = false + #api.alsa.period-size = 1024 + #api.alsa.headroom = 0 + #api.alsa.disable-mmap = false + #api.alsa.disable-batch = false } } } diff --git a/src/daemon/media-session.d/bluez-monitor.conf b/src/daemon/media-session.d/bluez-monitor.conf index 6ce209298..703e77b5f 100644 --- a/src/daemon/media-session.d/bluez-monitor.conf +++ b/src/daemon/media-session.d/bluez-monitor.conf @@ -54,7 +54,7 @@ rules = [ #node.nick = null #priority.driver = 100 #priority.session = 100 - #node.pause-on-idle = false + node.pause-on-idle = false #resample.quality = 4 #channelmix.normalize = false #channelmix.mix-lfe = false diff --git a/src/daemon/media-session.d/v4l2-monitor.conf b/src/daemon/media-session.d/v4l2-monitor.conf index d542a97bb..882d5af03 100644 --- a/src/daemon/media-session.d/v4l2-monitor.conf +++ b/src/daemon/media-session.d/v4l2-monitor.conf @@ -38,7 +38,7 @@ rules = [ #node.nick = null #priority.driver = 100 #priority.session = 100 - #node.pause-on-idle = true + node.pause-on-idle = false } } } diff --git a/src/daemon/pipewire.conf.in b/src/daemon/pipewire.conf.in index 6ffd19214..aefa6ee87 100644 --- a/src/daemon/pipewire.conf.in +++ b/src/daemon/pipewire.conf.in @@ -41,52 +41,95 @@ spa-libs = { } modules = { - ## = { [args = "= ..."] - # [flags = [ifexists]|[nofail]} + ## = { [args = { = ... }] + # [flags = "[ifexists]|[nofail]"} # # Loads a module with the given parameters. # If ifexists is given, the module is ignoed when it is not found. # If nofail is given, module initialization failures are ignored. # + + # Uses RTKit to boost the data thread priority libpipewire-module-rtkit = { - "#args" = { nice.level = -11 - rt.prio = 20 - rt.time.soft = 200000 - rt.time.hard = 200000 } - "flags" = "ifexists|nofail" + args = { + #nice.level = -11 + #rt.prio = 20 + #rt.time.soft = 200000 + #rt.time.hard = 200000 + } + flags = "ifexists|nofail" } + + # The native communication protocol libpipewire-module-protocol-native = null + + # The profile module. Allows application to access profiler + # and performance data. It provides an interface that is used + # by pw-top and pw-profiler. libpipewire-module-profiler = null + + # Allows applications to create metadata objects. It creates + # a factory for Metadata objects. libpipewire-module-metadata = null + + # Creates a factory for making devices that run in the + # context of the PipeWire server. libpipewire-module-spa-device-factory = null + + # Creates a factory for making nodes that run in the + # context of the PipeWire server. libpipewire-module-spa-node-factory = null + + # Allows creating nodes that run in the context of the + # client. Is used by all clients that want to provide + # data to PipeWire. libpipewire-module-client-node = null + + # Allows creating devices that run in the context of the + # client. Is used by the session manager. libpipewire-module-client-device = null + + # The portal module monitors the PID of the portal process + # and tags connections with the same PID as portal + # connections. libpipewire-module-portal = null + + # The access module can perform acces checks and block + # new clients. libpipewire-module-access = { - "#args" = { - # access.allowed to list an array of paths of allowed - # apps. - access.allowed = [ - @media_session_path@ - ] - # an array of rejected paths - access.rejected = [ ] - # an array of paths with restricted access - access.restricted = [ ] - # anything not in the above lists gets assigned the - # access.force permission. - access.force = flatpak - } + args = { + # access.allowed to list an array of paths of allowed + # apps. + #access.allowed = [ + # @media_session_path@ + #] + + # an array of rejected paths + #access.rejected = [ ] + + # an array of paths with restricted access + #access.restricted = [ ] + + # anything not in the above lists gets assigned the + # access.force permission. + #access.force = flatpak + } } + + # Makes a factory for wrapping nodes in an adapter with a + # converter and resampler. libpipewire-module-adapter = null + + # Makes a factory for creating links between ports libpipewire-module-link-factory = null + + # Provides factories to make session manager objects libpipewire-module-session-manager = null } objects = { - ## = { [args = "= ..."] - # [flags = nofail] } + ## = { [args = { = ... } ] + # [flags = "nofail"] } # # Creates an object from a PipeWire factory with the given parameters. # If nofail is given, errors are ignored (and no object is created) @@ -101,9 +144,10 @@ objects = { # A default dummy driver. This handles nodes marked with the "node.always-driver" # property when no other driver is currently active. JACK clients need this. spa-node-factory = { - args = { factory.name = support.node.driver - node.name = Dummy-Driver - priority.driver = 8000 + args = { + factory.name = support.node.driver + node.name = Dummy-Driver + priority.driver = 8000 } } }