Commit graph

2658 commits

Author SHA1 Message Date
Ashok Sidipotu
fcaece85e9 linking-utils: add routines to keep track of the priority media role link 2024-06-26 15:48:07 +03:00
Ashok Sidipotu
375094151d linking: get-filter-from-target.lua: bypass for media role targets 2024-06-26 10:16:10 +03:00
Ashok Sidipotu
4dd831424a linking: add a new hook to find media role targets 2024-06-26 10:16:10 +03:00
Julian Bouzas
4868b3c336 get-filter-from-target: Don't bypass the hook if the session item is a regular filter
Regular filters should be treated as regular stream / device nodes. Note that
the filter utils API is meant to be used using the direction of the main smart
filter nodes. This is why we use the target direction instead of the actual
stream direction to check if the stream session item is smart or not.
2024-06-25 14:15:46 -04:00
Julian Bouzas
fa67121665 filter-utils: Allow smart filters to have as target filters that are not smart
Filters that are not smart should be treated as regular client/device nodes,
therfore, smart filters should be able to use them as a target.
2024-06-25 14:05:43 -04:00
Wim Taymans
78dd8b1d8f tests: skip some tests when audiotestsrc is unavailable 2024-06-18 13:23:44 +02:00
George Kiagiadakis
47ec81408e scripts/device: avoid crashing if the device.name is not set
This should never happen, but there are odd cases with broken
configuration where such a device may appear and the least we can do
is not crash, at least not when the device.name is only used for
debug messages. In state-profile and other places where the name
really matters, we actually have checks in place.

Fixes: #674
2024-06-17 09:13:16 +03:00
George Kiagiadakis
31806862b0 tests/examples: add example on how to set node "params" under Props 2024-06-15 14:05:27 +03:00
Julian Bouzas
2353a0991b autoswitch-bluetooth-profile: Always destroy the restore timeout source before switching
We always have to destroy the restore timeout source when we want to switch to
HSP/HFP profile, even if the device is already set to HSP/HFP or has already an
input route. Apart from this, we also want to make sure there is no pending
timeout source when we are creating a new one. This should avoid an infinite
loop about switching BT profiles when capture nodes are created and destroyed
quickly.
2024-06-12 16:27:19 -04:00
James Calligeros
f57a46308d node/software-dsp: ensure that filter chains are properly unloaded
Indexing into the subject from a node-removed event is slightly quirky.
As a result, we were not properly freeing filter chains tied to
disconnected nodes.

Change how we store the list of loaded filters and ensure they
are properly freed when their parent node is removed from the graph.

Signed-off-by: James Calligeros <jcalligeros99@gmail.com>
2024-06-10 11:31:50 +00:00
Julian Bouzas
eb707096f7 scripts: Fix autoswitch BT profile when using filters
If a source filter is used, the BT profile autoswitch does not work because
WirePlumber thinks there is always a client capturing audio from it. This patch
fixes the issue by recursively walking through the source filters that are
linked to the BT loopback source until a stream is found. If a stream is found
at the end of the chain, then it switches to HSP/HFP profile, if the stream is
not found, the profile stays to A2DP.
2024-06-06 17:05:18 -04:00
Julian Bouzas
789b526c61 bluez: Don't create loopback source if autoswitch setting is disabled 2024-06-06 17:00:46 -04:00
George Kiagiadakis
be9259d952 conf: further improve how top-level objects are handled
With this change, it is possible to have a top-level object that does
not start at exactly the beginning of the file, allowing comments and
whitespace to exist.

Also add an empty conf file in the tests to verify that
it does not crash.
2024-06-02 15:47:09 +03:00
George Kiagiadakis
5235c025fe conf: skip empty configuration files to avoid crashing
g_mapped_file_get_contents() returns NULL if the file is empty

Fixes: #671
2024-06-02 15:17:06 +03:00
George Kiagiadakis
65e4ae83b9 0.5.3 2024-06-01 14:53:36 +03:00
Barnabás Pőcze
53e3cc7c7e metadata: remove incorrect transfer annotation 2024-05-31 23:03:12 +02:00
Barnabás Pőcze
b6595fb586 core: add missing \ingroup 2024-05-31 23:00:36 +02:00
Barnabás Pőcze
7e21e27ca9 docs: gen-api-gtkdoc.py: fix SyntaxWarning with raw strings
Use raw strings for regex patterns to avoid the invalid escape
sequence `SyntaxWarning`.
2024-05-31 22:54:13 +02:00
George Kiagiadakis
0b51b6b570 gi: hide WP_PRIVATE_API functions from gir
Document them and annotate them with (skip) so that they are
marked as introspectable=0 in the gir file.

Fixes: #599
2024-05-31 21:00:07 +03:00
George Kiagiadakis
ba0de72a9d tests: conf: test a few more edge cases
- split merge.conf into two files, one being standard JSON,
  to ensure we can parse this
- ensure that key-value pairs are correctly overriden when
  merging without the override. prefix
- remove context.modules, which is no longer needed there
- fix a typo with a stray ; character
2024-05-31 19:55:07 +03:00
George Kiagiadakis
5ec1d2c2e1 tests: conf: add test for as-section parsing 2024-05-31 19:54:04 +03:00
George Kiagiadakis
a3d5c8088b lib: conf: make it possible to parse files wrapped in {}, to allow standard JSON
A bit of refactoring was needed in order to avoid breaking as-section
loading, which expects the entire file to be an object or array and doesn't
parse it.

Fixes: #633
2024-05-31 18:35:32 +03:00
George Kiagiadakis
9847ca129a lib: spa-device: emit object-removed & create-object in sequence when an object is updated
In some cases the monitors emit the object_info callback with the same id
and non-NULL info multiple times. For example, when an ACP profile changes from
output:analog-stereo+input:analog-stereo to just output:analog-stereo, it emits
object_info() with NULL info for the input node and object_info() with updated
properties and the same id as before for the output node.

This causes the spa-device here to emit create-object multiple times for the
same object and this breaks the name deduplication logic. To solve this, make
sure we emit object-removed before calling create-object a second time.

Fixes #500
2024-05-31 17:04:18 +03:00
George Kiagiadakis
e6eed2dfb0 monitors/alsa: add some logging around node name deduplication 2024-05-31 17:03:33 +03:00
George Kiagiadakis
e3e8c9cdcb device/state-profile: do not restore unavailable profiles from the state file
Fixes: #613
2024-05-31 12:14:19 +03:00
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