Commit Graph

2633 Commits

Author SHA1 Message Date
George Kiagiadakis
9b4628455c node/create-item: simplify si properties configuration
Copy all the node properties into the session item and customize
afterwards, instead of starting with an empty set and cherry-picking
properties... We need to cherry-pick more and more properties
overtime and it's easy to make mistakes
2024-05-24 20:41:16 +03:00
George Kiagiadakis
df8bc12464 state-stream: fix using the default volume
When there was no previous state stored, the default volume was
also not applied because the code would return from the hook early

Fixes: #655
2024-05-24 20:36:28 +03:00
Julian Bouzas
b40ba825c2 filter-utils.lua: Check media type when finding the default filter
This avoids wireplumber trying to link a video stream node with the default
audio smart filter if smart audio filters are configured.
2024-05-24 07:33:21 -04:00
George Kiagiadakis
226be2e2b2 monitor-utils: fix variable check
See !636
2024-05-23 12:59:46 +03:00
George Kiagiadakis
2811d46a38 monitor-utils: make cam_api_data a local variable
Otherwise it is global and it retains a reference to the `parent`
WpSpaDevice object until this function is called again, which prevents
some camera nodes - in some cases - from being destroyed

Fixes #640
2024-05-23 12:35:23 +03:00
Barnabás Pőcze
4ed51791e0 linking: return after aborting transition
Avoid calling return_error() on the same transition multiple times.

Fixes: 4b153ec553 ("link-target.lua: change into a async hook")
See #628
2024-05-18 01:36:39 +02:00
Barnabás Pőcze
89b6766cd6 transition: ensure single completion and finish
At the moment, the same transition can be completed multiple times
(assuming sufficiently high reference count):

  return_error()
  finish()
  return_error()

The consequence of that is that the transition closure will be
invoked multiple times. This is unexpected.

Add some guards against completing a transition or calling finish()
multiple times.

Fixes #628
2024-05-18 01:36:39 +02:00
Barnabás Pőcze
1ddfbc532c transition: fix memory leak when error is already set
Fixes: 18377fbf82 ("transition: don't allow _return_error() to be called recursively")
2024-05-18 00:46:58 +02:00
Ashok Sidipotu
88d1dd86e5 wireplumber.conf: increase the cam discovery timer value 2024-05-08 14:20:16 +00:00
Ashok Sidipotu
a6328cf2c1 m-lua-scripting: correct typo 2024-05-08 14:20:16 +00:00
Ashok Sidipotu
06e11dc4be monitors/camera: fix camera device deduplication not working for certain devices.
Enhance the parsing logic to consider more than one device number. libcamera
devices some times use up multiple V4L2 devices, in this case libcamera should
be given a chance to enumerate the device.

Fixes #623
2024-05-08 14:20:16 +00:00
Tom Hughes
ae983e6fd7 Improve monitoring of seat state
If the user is reported as active then check that they have at
least one active seat and downgrade the status to online if not.

This ensures that a remote login session won't be interpreted as
the user being active on a local seat.
2024-05-08 13:58:16 +00:00
George Kiagiadakis
3e643aad85 log: use G_GNUC_DEPRECATED_FOR to deprecate wp_log_checked 2024-05-03 13:46:52 +00:00
Pauli Virtanen
2fb055f43d log: add wp_logt_checked taking WpLogTopic, to decide on debug messages
Make decision on whether to show code location in journal messages based
on whether the WpLogTopic would enable DEBUG level messages.

Add wp_logt_checked API to take WpLogTopic as input to make this
possible, and deprecate wp_log_checked.
2024-05-03 13:46:52 +00:00
Pauli Virtanen
8016ad1cec log: prepend topic to journald logs & add locations on debug levels
Logging messages are usually developed based on the stderr logging,
which shows code location and log topics as context, and especially
higher log level messages can be cryptic or useless without that
context.

This context is not shown in journalctl by default, and so usually is
missing from logs submitted by users. In principle it is available in
journalctl but requires extra work to show it.

Fix by prepending the log topic to the messages, like Pipewire logging
does. Also show code locations if log level is high enough.
2024-05-03 13:46:52 +00:00
George Kiagiadakis
4eb9454ceb wireplumber.conf: add a video-only profile
For systems where only camera & screensharing are to be used.

Fixes: #652
2024-05-03 16:13:10 +03:00
George Kiagiadakis
e6a70db254 json-utils: fix overriding of non-container values when merging
Non-container values should always be overriden

Fixes: #653
2024-05-03 15:54:37 +03:00
Julian Bouzas
0bd64f17af filter-utils: Check main filter nodes in a more robust way
This patch makes the check more robust when detecting main filter nodes. This is
because some filters might append '/Internal' to their main node media class.
The direction check has also been improved to work with Video filters.
2024-05-02 12:26:55 -04:00
Stefan Ursella
709eecb21f lua: json: fix error ouput 2024-04-30 05:32:33 +00:00
Stefan Ursella
fd7a1af7ff lua: json: add method to merge json containers 2024-04-30 05:32:33 +00:00
Pauli Virtanen
42370f0547 scripts: fix event:get_data() usage in apply-profile
event:set_data() coerces Lua tables to properties, so that keys and
values become strings.  Take into account that profile.index is a string
due to this.

Fixes WP setting the profile, even though it is already the active one.
2024-04-27 17:48:16 +03:00
George Kiagiadakis
b302ebd6ab 0.5.2 2024-04-22 17:19:47 +03:00
Pauli Virtanen
7f30adeb42 core: fix WpLoopSource lifecycle
Currently nothing removes the WpLoopSource from the main context, and we
moreover are creating and attaching unused WpLoopSources when sharing
same pw_context between multiple WpCore.

Fix this by keeping track of the WpLoopSource in the pw_context user
data, only creating them when needed, and finalizing it after the
context is destroyed.
2024-04-22 08:49:28 +00:00
Pauli Virtanen
7997fd490b core: keep pw loop entered exactly when it is running
It is intended that the Pipewire loops are "entered" the whole time they
are running, i.e. are going to process further events. Currently we
enter/leave for single iterations, which is not right.

Fix by entering the loop on initial GSource idle callback, and leaving
at finalize.

That the loop has to be left from the same thread it was entered from is
a bit hard to do with GSources, as the finalize callback appears not
guaranteed to be called from any particular thread.  I didn't find a
fully general way to do this, so this puts additional constraints on how
WpLoopSource (and WpCore) are to be cleaned up.
2024-04-22 08:49:28 +00:00
George Kiagiadakis
e4f9fb824e default-nodes: fallback to priority.driver if priority.session is not set
See #642
2024-04-22 11:39:45 +03:00
Stefan Ursella
473e463c56 meson: create the lib version like pipewire
If we use the project version as library version,
it is not possible to append something to the
project version to indicate a modified wireplumber version.
2024-04-18 09:35:23 +00:00
James Calligeros
1844fd6d61 Revert "node/software-dsp: do not hide target node when hide-parent is false"
Using parseBool is actually more broken if the property is already parsed as a
boolean, and causes the node to remain unhidden even when hide-parent = true.

Revert 2a45842169 to fix this behaviour.

Signed-off-by: James Calligeros <jcalligeros99@gmail.com>
2024-04-17 18:31:09 +10:00
James Calligeros
4c57647203 docs: document filter-path property of software DSP policy
Signed-off-by: James Calligeros <jcalligeros99@gmail.com>
2024-04-17 18:31:09 +10:00
James Calligeros
d89293b606 node/software-dsp: implement loading filter graphs from disk
Using the new Conf() constructor, we can load and parse a filter graph
from a file on disk. This is useful when, for example, maintaining a
large database of filter graphs. It also keeps wireplumber.conf.d free
from clutter.

Signed-off-by: James Calligeros <jcalligeros99@gmail.com>
2024-04-17 18:31:09 +10:00
James Calligeros
d77edf70e9 lua: allow Conf methods to be indexed or called
Given that we are allowing Conf() to instantiate a new WpConf,
the methods on the class need to be callable in reference to Self while
maintaining API compatibility with being indexable from the table as a
static method.

Allow this by checking if the first argument passed in is userdata.

Signed-off-by: James Calligeros <jcalligeros99@gmail.com>
2024-04-17 18:31:09 +10:00
James Calligeros
f769ea8f30 lua: add constructor and file ops for WpConf
This exposes the ability to load a SPA-JSON representation of a WpConf
object from an arbitrary file on disk to the Lua API

Signed-off-by: James Calligeros <jcalligeros99@gmail.com>
2024-04-17 18:31:04 +10:00
James Calligeros
59d29f37ac conf: allow a SPA-JSON container to be loaded as a named WpConf section
A "plain" JSON object may be passed to WpConf constructors. Previously, this
would cause an error as open_and_load_sections expects the first parsed token
to be a string. Use WpProperties to denote that the file being parsed is an
object/container, and specify a section name for it.

Signed-off-by: James Calligeros <jcalligeros99@gmail.com>
2024-04-09 13:15:50 +00:00
James Calligeros
34040d8e44 conf: allow a WpConf to be loaded without fragments
Use WpProperties to indicate that searching for and loading
conf.d fragments can/should be skipped.

Signed-off-by: James Calligeros <jcalligeros99@gmail.com>
2024-04-09 13:15:50 +00:00
James Calligeros
42666e2054 conf: Add WpProperties as a member of WpConf
WpProperties may be used to control the behaviour of a WpConf
object. This allows those properties to be referenced at any time
during the lifetime of a WpConf.

Signed-off-by: James Calligeros <jcalligeros99@gmail.com>
2024-04-09 13:15:50 +00:00
James Calligeros
105d53025e conf: explain behaviour of wp_base_dirs_find_file
The signature of the function is quite misleading. If an absolute
path is passed to it, it will ignore the directory constraint flags
and search outside of the specified directories anyway. Make a note
of this in its caller.

Signed-off-by: James Calligeros <jcalligeros99@gmail.com>
2024-04-09 13:15:50 +00:00
George Kiagiadakis
8892204f24 wplua/sandbox: support mixing static methods and constructors in class identifiers
Global class identifiers, such as "Node", "SessionItem", "Conf", etc
are so far defined either as methods, which are constructors for
the GObject class, or as tables, which contain "static" methods, i.e.
methods that can be called without an instance.

In some cases, we may want to mix a class being both instantiatable
with a constructor and also have static methods. To support this,
allow the class identifier be declared as a table with the constructor
being defined as the "__new" method. This change allows calling the
table as a method and execute "__new" underneath.

For instance:
```
json = Conf.get_section_as_json("foobar") -- static method
conf = Conf("/foo/bar") -- constructor, equivalent to Conf.__new("/foo/bar")
```

See also !629
2024-04-09 13:15:50 +00:00
Pauli Virtanen
9d7c6b85d0 monitors/bluez: fix BAP device set node naming
It is intended that its name is the actual device node name.
Fix this, as it was broken in some recent changes.
2024-04-06 21:59:16 +03:00
George Kiagiadakis
8ee351838d monitor-utils: clear cam data after creating nodes
The cam_data structure stores a reference to the "parent" WpSpaDevice
and doesn't allow it to be destroyed when the monitor detects that
the device is no longer present. Clear it right after pushing the event
to make sure there's no dangling reference left around

Fixes: #627
2024-04-03 12:31:42 +00:00
George Kiagiadakis
7856124df0 core: set context.modules.allow-empty to silence warning in pw_context
See cddea858d9

Closes: #620
2024-04-03 11:52:18 +03:00
George Kiagiadakis
961450b2ac 0.5.1 2024-03-30 16:50:38 +02:00
George Kiagiadakis
1fddefa072 docs: move the software_dsp document down in the TOC
This is one of the least likely things that a user would want to
discover and use, making it wierd to be the very first "policy"
to present.
2024-03-30 15:52:14 +02:00
George Kiagiadakis
ab18cb1848 docs: improve the wording and formatting of the software_dsp doc 2024-03-30 15:44:38 +02:00
George Kiagiadakis
3b0c0fcd7e state-stream: fix storing/restoring notification volume
We apparently store things in the <media-class>:<key>:<value>
format, while pipewire-pulse expects <media-class>.<key>:<value>
and this detail was missed in the latest refactoring.

It also seems that I forgot to ensure that restoring this metadata
key worked. The hook was there, but not registered.
Remove the hook and directly populate the metadata object when
it is activated, as it seems simpler.

Fixes: #604
2024-03-30 11:53:45 +02:00
James Calligeros
2a45842169 node/software-dsp: do not hide target node when hide-parent is false
The existence of props["hide-parent"] is truthy. Parse the boolean explicitly
to get the correct logic.

Signed-off-by: James Calligeros <jcalligeros99@gmail.com>
2024-03-30 00:00:57 +10:00
James Calligeros
b45eafa53c docs: Document automatic software DSP handling
Signed-off-by: James Calligeros <jcalligeros99@gmail.com>
2024-03-30 00:00:52 +10:00
James Calligeros
692e6e4b5b wireplumber.conf: add node.software-dsp to wireplumber.components
This component provides the automatic filter graph interface to consumers.
We provide the component by default, however it is not activated unless
explicitly requested in wireplumber.profiles by a consumer.

Signed-off-by: James Calligeros <jcalligeros99@gmail.com>
2024-03-29 23:49:21 +10:00
James Calligeros
82b0ec8c30 node/software-dsp: Port Node ObjectManager to SimpleEventHook
Signed-off-by: James Calligeros <jcalligeros99@gmail.com>
2024-03-29 23:48:09 +10:00
James Calligeros
9ab7c024f8 node/software-dsp: get match rules from conf.d
This allows DSP rules to be specified in a wireplumber.conf.d file under
the node.software-dsp.rules section. Properties are specified in the
software-dsp action.

Signed-off-by: James Calligeros <jcalligeros99@gmail.com>
2024-03-29 23:46:54 +10:00
James Calligeros
d5217fd4b6 node/software-dsp: move and rename scripts/policy-dsp.lua
As this DSP "policy" is intended to run on the creation/deletion
of a node, move it into the node subdir.

Signed-off-by: James Calligeros <jcalligeros99@gmail.com>
2024-03-29 22:44:53 +10:00
James Calligeros
62dd6effa8 policy-dsp: allow matching on all node properties
Prevously, we were only looking at node["global-properties"] for
properties to match on. Change this to instead run against
node.properties, so that we can use type-specific properties such as alsa.id.

Signed-off-by: James Calligeros <jcalligeros99@gmail.com>
2024-03-26 19:14:05 +10:00