Commit graph

2746 commits

Author SHA1 Message Date
Andrew Sayers
d91c366c2f
Change the new "skipping device" warning to debug
The other "skipping device" (a few lines later) uses log:debug,
so it makes sense for these to be the same.
2025-02-21 13:03:03 +00:00
Barnabás Pőcze
5846d12ea1 wpctl: fix types in variadic arguments
`wp_object_manager_add_interest()` passes the format string
and the arguments after that to `g_variant_new()`, which
requires a 32-bit integer for "u". Passing a 64-bit integer
will cause problems on certain ABIs.

Furthermore, remove the metadata related interest declaration
from `set_default_prepare()` since the "set-default" command
does not access metadata directly, it uses the "default-nodes-api"
plugin.

Fixes: 7784cfad92 ("wpctl: support @DEFAULT_{AUDIO,VIDEO}_{SINK,SOURCE}@ as ID ")
Fixes #773
2025-02-19 18:49:07 +01:00
Barnabás Pőcze
f3bc7168ed wpctl: fix default device name leak
The `get-default-configured-node-name` handler returns a copy
of the name of the node, hence it must be freed.
2025-02-19 18:35:42 +01:00
George Kiagiadakis
32d2abdf34 internal-comp-loader: generate a "provides" for components that don't have one
It is valid for components not to have a "provides" field, but it
prevents them from being able to have "before" and "after" dependencies.
With this patch, we generate a hidden "provides" field so that the
dependencies sorting algorithm can work without issues.

Fixes: #771
2025-02-13 16:06:29 +02:00
George Kiagiadakis
ac69acb3c2 0.5.8 2025-02-07 17:42:58 +02:00
George Kiagiadakis
b031d3fcd1 scripts: populate session.services via a script
See pipewire!1409 / wireplumber!441
2025-02-07 11:05:44 +00:00
George Kiagiadakis
b697546476 lua: bind wp_core_update_properties() 2025-02-07 11:05:44 +00:00
George Kiagiadakis
b8f0cf3644 monitors/bluez: make the source loopback node appear as non-virtual
Fixes: #729
2025-02-07 12:54:43 +02:00
George Kiagiadakis
14cbddd007 tests/scripts: fix tests to respect "object.serial" vs "node.id" differences
Fixes: #761
2025-02-07 08:54:05 +02:00
Twlvnn Kraftwerk
48a415bc8f Update Bulgarian translation
Based of on https://l10n.gnome.org/vertimus/WirePlumber/master/po/bg/

Signed-off-by: Alexander Shopov <ash@kambanaria.org>
2025-02-05 12:09:53 +01:00
luzpaz
cb770c1d7e docs: fix various codebase typos Found via codespell -q 3 -S "*.po,./po/*,NEWS.rst" -L bootup,gir,inout 2025-01-28 15:45:54 +01:00
Pauli Virtanen
899943bfcf monitors: disable stream-restore for device loopback nodes
stream-restore should not be touching node properties of the Bluetooth
mic / device set / offload / ALSA UCM split loopback nodes. Those are
controlled by Route settings on the device.

Set device.routes and state.restore-props=false as appropriate to avoid
that.
2025-01-26 21:33:22 +02:00
George Kiagiadakis
a1bc3d9285 lua: fix wp_lua_log_topic_copy() to copy the topic name correctly
Fixes: #757
2025-01-08 11:35:57 +02:00
Pauli Virtanen
4d02d0275f monitors/alsa: provide splitting of UCM SplitPCM nodes
Instruct ACP to provide information about UCM SplitPCM channel
splitting instead of doing it with alsa-lib plugins.

Use the provided information to load loopbacks that create virtual sinks
that do the channel remapping from UCM.
2024-12-23 11:42:23 +02:00
Pauli Virtanen
83e93876d5 lib: spa-device: fix POD props iteration + key lifetimes
Fix memory leaks in bad GValue handling.  Unset iterator GValue after
use and strdup keys.  The keys aren't necessarily static strings (for
id-XXXX properties), so have to be dup'd.
2024-12-20 19:44:36 +02:00
Pauli Virtanen
027aba7f3b monitors/bluez: rename api.bluez5.id -> spa.object.id
Use same name as in alsa monitor.
2024-12-19 18:45:16 +02:00
Pauli Virtanen
ada687a4cc monitors/alsa: decouple name deduplication from node objects
Node name deduplication relying on presence of node objects creates race
conditions, as the name cannot be marked unused if the node object was
not created or was destroyed.

Use separate (device_id, node_id) -> name table to track name ownership
separately from the existence of node objects.

Also clear up the reserved names when device is destroyed, by the
monitor or device reservation.  In these cases "object-removed" for
nodes is not called, so this fixes names leaking when e.g. pw-reserve is
used.
2024-12-19 18:41:01 +02:00
Pauli Virtanen
65989e7e38 monitors: use WpSpaDevice:set_managed_pending()
In cases where a Node is created asynchronously and associated with the
Device later, set the id pending so that we don't miss ObjectConfig
events.

The "set Route again" workaround is also not needed, moreover it was not
reliable before either since the Device might issue ObjectConfig only
for changed properties.
2024-12-15 20:51:55 +02:00
Pauli Virtanen
2df5d94697 m-lua-scripting: add WpSpaDevice:set_managed_pending 2024-12-15 20:51:55 +02:00
Pauli Virtanen
22ab3c938f lib: spa-device: add wp_spa_device_set_managed_pending()
Allow marking WpSpaDevice object ids "pending", which means Props from
any ObjectConfig events received for the ids are saved, if there is no
associated object set yet.

When wp_spa_device_store_managed_object() is called, any pending Props
are set on the managed object.

This is useful when nodes cannot be immediately created in the
"create-object" signal handler. For example, in cases where the nodes
are created asynchronously, e.g.  by "module-loopback".  In this case,
although the nodes can be later associated with the WpSpaDevice, any
ObjectConfig events received in the meantime are lost, so for example
restoring saved Routes will race against async node creation.  Using
wp_spa_device_set_managed_pending() solves this race condition.
2024-12-15 20:51:55 +02:00
Quentin
2bfc464444 Update Occitan locale 2024-12-10 17:18:41 +00:00
Pauli Virtanen
4c1a6f5840 monitors/bluez: recreate SCO source when loopback is emitted
If loopback is emitted after the SCO node, e.g. when A2DP profile
connects late, recreate the SCO node.

This ensures the underlying SCO node is hidden when the loopback is
present.
2024-12-09 20:28:53 +02:00
George Kiagiadakis
3e7c87a84c 0.5.7 2024-12-02 16:10:17 +02:00
George Kiagiadakis
4c07fd1da1 device: find-preferred-profile: define device_name variable
Fixes: #751
2024-12-02 12:18:42 +02:00
George Kiagiadakis
e76ebde6d8 conf.d.examples: improve alsa.conf
Completely remove references to auto-profile/auto-port.
It's better if users are not tempted to enable them.
2024-11-28 16:04:55 +02:00
George Kiagiadakis
f79d4b1b3b monitors: alsa: disable api.acp.auto-profile by default
This seems to be an omission from when we transferred the default device
properties from the config file on to the Lua script. Both auto-profile
and auto-port are meant to be disabled, so that we can apply our own
management logic.

Fixes: #734
2024-11-28 16:02:57 +02:00
George Kiagiadakis
77d2dcd97f autoswitch-bluetooth-profile.lua: drop local function declarations
There is no point in local functions in the global script scope.
We use a sandbox anyway to isolate from other scripts.
2024-11-28 11:55:38 +02:00
Pauli Virtanen
1ddb473deb monitors/alsa: handle node activation failure
When node activation fails, it won't be created and its object-removed
signal can be called with some properties missing.  This breaks node
name deduplication, causing error

wplua: [string "alsa.lua"]:182: attempt to concatenate a nil value (local 'node_name')

It occurs e.g. when switching ALSA device profile, while some
application has opened the device with ALSA and is keeping it busy.

Fix by handling the activation failure, and tolerating missing property
in object-removed.
2024-11-23 17:11:37 +02:00
Wim Taymans
f4f495ee21 node: cast proxy to pw_node* when calling pw_node functions
This currently works fine because the functions accept void* but will
fail when they accept struct pw_node* in the future.
2024-11-20 10:10:09 +01:00
Andika Triwidada
19526e128f Update Indonesian translation 2024-11-11 10:37:30 +00:00
Pauli Virtanen
b65b53b200 m-reserve-device: cancel get proxy callback properly
Cancel the async calls that get the name of the application owning the
service, when WpReserveDevice is finalized or we are going to make
another call.

Fixes UAF accessing self when the async callback runs.
2024-11-01 20:46:54 +02:00
Pauli Virtanen
71f8682337 po: update Finnish translation 2024-10-12 13:46:30 +03:00
Julian Bouzas
76985fff5b autoswitch-bluetooth-profile: Switch to HSP/HFP on timeout
This patch adds a 500ms timeout callback to switch to HSP/HFP when a stream
starts capturing BT audio. This avoids quickly switching from A2DP to HSP/HFP
back and forth if an application just wants to probe the BT source for a short
period of time.

See #634
2024-10-10 15:54:59 +00:00
George Kiagiadakis
881c7ce2d7 ci: improve the rules of the previous commit 2024-10-09 17:15:47 -04:00
George Kiagiadakis
e3fbc91abf ci: optimize the CI to run less when not needed
Some jobs do not make sense to be run on certain cases and we can save
CI cycles that way.

Most build rules can be run only on merge requests and custom branches.
On master, it only makes sense to build fedora_with_docs for the
purpose of deploying updated documentation on gitlab pages.
The analysis steps only make sense to run when the relevant files have
changed.
2024-10-09 17:05:19 -04:00
lumingzh
51b68a7c20 update Chinese translation 2024-10-09 18:03:54 +00:00
Arun Raghavan
f5ed10d857 ci: Add workflow rules to avoid duplicate branch/MR pipelines
Copied from pipewire@15b5185e6fa5d4437b6acd9cbdf7a698e01019ab
2024-10-09 14:01:16 -04:00
Jhonata Fernandes
3e101f6941 Update Brazilian Portuguese translation 2024-10-09 17:33:31 +00:00
Robert Mader
b2d2f656fd monitor-utils: Check all libcamera v4l2 devices
The actual deduplication only checked the first device. Extend it to the
full list, as intended.

Fixes: 848b6326 (monitor-utils: Rework camera deduplication code)
2024-10-03 10:46:49 +02:00
Robert Mader
848b6326a9 monitor-utils: Rework camera deduplication code
The previous code made some invalid assumptions and was rather
complicated. Rework and simplify it.

The approach work as follows:
1. Once a new device gets registered, store its data in a list of pending
   devices.
2. Start a timer. On timeout, we check all pending devices and depulicate
   according to our heuristic. The timer gets reset whenever a device is
   added in order to avoid race conditions.
3. On timeout, add the pending devices to categories. For now: UVC cameras
   from the V4L2 plugin, libcamera cameras and other cameras from the V4L2
   plugin.
4. Then process the different categories in order of preference and store
   their V4L2 device IDs in a list for each plugin.
5. Before creating a camera, check that the V4L2 device(s) it uses are not
   yet used by a already existing camera from the other plugin.

While on it, drop support for Pipewire versions that don't report V4L2
device IDs at all.

Closes https://gitlab.freedesktop.org/pipewire/wireplumber/-/issues/689
Closes https://gitlab.freedesktop.org/pipewire/wireplumber/-/issues/708
2024-09-30 01:06:40 +02:00
Barnabás Pőcze
ed80938b8c module-dbus-connection: fix GCancellable leak
`wp_dbus_connection_disable()` creates a new GCancellable
object at the end, which is never freed if the GObject
is then destroyed. To fix this, override `finalize()` and
clear everything there as well.

Direct leak of 64 byte(s) in 1 object(s) allocated from:
    0 0x70e688efd1aa in calloc /usr/src/debug/gcc/gcc/libsanitizer/asan/asan_malloc_linux.cpp:77
    1 0x70e6874b3e62 in g_malloc0 (/usr/lib/libglib-2.0.so.0+0x63e62) (BuildId: 7b781c8d1a6e2161838c5d8f3bd797797c132753)
    2 0x70e6875dea75 in g_type_create_instance (/usr/lib/libgobject-2.0.so.0+0x3ea75) (BuildId: 5af5e0f7d0a900ecb6083fbd71e22e5522d872e2)
    3 0x70e6875c3804  (/usr/lib/libgobject-2.0.so.0+0x23804) (BuildId: 5af5e0f7d0a900ecb6083fbd71e22e5522d872e2)
    4 0x70e6875c4e7e in g_object_new_with_properties (/usr/lib/libgobject-2.0.so.0+0x24e7e) (BuildId: 5af5e0f7d0a900ecb6083fbd71e22e5522d872e2)
    5 0x70e6875c5ed1 in g_object_new (/usr/lib/libgobject-2.0.so.0+0x25ed1) (BuildId: 5af5e0f7d0a900ecb6083fbd71e22e5522d872e2)
    6 0x70e684d2a8a6 in wp_dbus_connection_disable ../subprojects/wireplumber/modules/module-dbus-connection.c:173
    7 0x70e688a833cc in wp_plugin_deactivate ../subprojects/wireplumber/lib/wp/plugin.c:144
    8 0x70e688a7126c in wp_object_deactivate ../subprojects/wireplumber/lib/wp/object.c:542
    9 0x70e688a6e74e in wp_object_dispose ../subprojects/wireplumber/lib/wp/object.c:191
    10 0x70e6875c0f6c in g_object_unref (/usr/lib/libgobject-2.0.so.0+0x20f6c) (BuildId: 5af5e0f7d0a900ecb6083fbd71e22e5522d872e2)
    11 0x70e6841f7d6d in wp_portal_permissionstore_plugin_disable ../subprojects/wireplumber/modules/module-portal-permissionstore.c:207
    12 0x70e688a833cc in wp_plugin_deactivate ../subprojects/wireplumber/lib/wp/plugin.c:144
    [...]
2024-09-26 15:08:39 +02:00
Torkel Niklasson
255b65d182 m-mixer-api: Fix memory in leak wp_mixer_api_set_volume
Declare result from wp_object_manager_lookup as g_autoptr, to prevent
leaking memory.
2024-09-26 14:12:18 +02:00
Pauli Virtanen
b68a6794cd autoswitch-bluetooth-profile: switch only Bluetooth devices
Handle only devices associated with Bluetooth loopback nodes.

Make sure the node.link-group iteration cannot get stuck if there is a
loop in the link graph.
2024-09-10 07:51:03 +00:00
George Kiagiadakis
141b2d5d3f 0.5.6 2024-09-05 20:59:11 +03:00
George Kiagiadakis
f2013d8cd0 lib: wp_core_connect_fd: add \since marker 2024-09-05 20:19:33 +03:00
George Kiagiadakis
e7dc79859d docs: document multi-instance configuration profiles 2024-09-05 20:12:03 +03:00
Robert Rosengren
ec8975ac6a docs: clarified how to setup debug logs in lua 2024-09-05 10:52:28 +00:00
George Kiagiadakis
40e5dbff3d systemd: load the system instance with the 'main-systemwide' profile by default
This can still be overriden in the configuration file, if needed.

See #608
2024-09-03 11:40:05 +03:00
George Kiagiadakis
43ea3db02c wireplumber.conf: add systemwide, embedded and split-instance profiles
Revamp the profiles section, making use of the inherits feature
and add commonly used profiles for systemwide & embedded use cases,
as well as profiles for a split-instance configuration where the
policy hooks run in a separate instance from the alsa, bluetooth
and camera monitors (which run in 3 separate instances respectively)

Also add an example on how to configure the loaded profile using
a config file instead of the CLI switch.

Fixes: #608
2024-09-03 11:39:10 +03:00
George Kiagiadakis
a061018150 internal-comp-loader: implement profiles inheriting other profiles
This allows to inherit all the profile definitions of another profile
before the current profile's definitions are parsed, allowing for
more complex structures to be present in the default wireplumber.conf
without too much copy-paste
2024-09-02 17:00:53 +03:00