Commit graph

1573 commits

Author SHA1 Message Date
Julian Bouzas
49f1ead1a7 si-standard-link: always return transition error if activation fails
Avoids having the session item in an invalid state.
2021-11-25 16:06:17 +00:00
Julian Bouzas
9ed6af021f si-audio-adapter: always return task error if set ports format fails
Avoids having the session item in an invalid state.
2021-11-25 16:06:17 +00:00
Julian Bouzas
45d567b488 si-audio-adapter: clean up unneeded code when setting ports format 2021-11-25 16:06:17 +00:00
Wim Taymans
efd2458418 alsa: handle the release-requested signal
Handle the release-requested signal by destroying the device and
then calling release.

Fixes pipewire/pipewire#1846
2021-11-23 13:17:29 +01:00
Wim Taymans
c88fbd20e6 Revert "policy-node: Remove direction check"
This reverts commit b6072f4179.

This is not right because when 2 nodes have the same name, there is
no way to know which one to use. It is better to rely on the
PW_KEY_STREAM_CAPTURE_SINK property when capturing from a monitor.
2021-11-23 11:47:08 +01:00
Peter Hutterer
ee5f3f2f19 lib: don't read hidden files from the config directory
Fixes #104
2021-11-21 07:48:07 +00:00
Wim Taymans
83041b0ce2 policy-node: wait for nodes when we become unlinked
If we were linked before but our node is removed, wait until a new node
becomes available instead of failing.

This fixes an issue where there is only 1 sink available and the card
profile is toggeled between pro and stereo. After the profile is
toggled, the sink is removed and the node would be killed with an error
because there is no fallback sink. The fix is similar to the
pipewire-media-session logic.
2021-11-18 15:23:23 +01:00
Peter Hutterer
5ec2138a72 log: support strings as level selectors in WIREPLUMBER_DEBUG
This allows for WIREPLUMBER_DEBUG="D" which avoids users having to
remember which numerical value the various levels have. The strings to
select are the ones printed by the logger, i.e. UECWMIDT.
2021-11-18 12:17:19 +00:00
Peter Hutterer
21266a5bec lib: correct documentation for wp_iterator_fold/foreach 2021-11-18 12:09:57 +00:00
Peter Hutterer
1121618387 lib: fix some incorrect docs for signals 2021-11-18 12:09:57 +00:00
Peter Hutterer
9208ea051c Fix some typos 2021-11-18 12:09:57 +00:00
Peter Hutterer
f4546a18e8 m-reserve-device: replace the hash table key on new insert
We're using the WpReserveDevice's name as key in the hash table, so we
must update the key as well when we replace an item in the hashtable -
the old device (and its name) will be released.

The side-effect of this is that the *third* device with an identical
name will no longer replace the previous device. This results in the
following sequence:

- dev1 added: name Audio0
  - dev1 requests name owner Audio0
- dev2 added: name Audio0
  - replace dev1 in the hashtable
     - dev1 emits "release" signal
     - dev1 unowns the Audio0 name
  - dev2 requests name owner Audio0
- dev3 added: name Audio0
  - adds to the hashtable because the existing key is now undefined
  - dev3 requests name owner Audio0
     - error, you cannot request ownership for the same name twice

Fixes #93
2021-11-18 12:00:09 +00:00
Peter Hutterer
f7e8bad414 ci: use FDO_CI_CONCURRENT if available to control the job count 2021-11-18 11:51:14 +00:00
Wim Taymans
b6072f4179 policy-node: Remove direction check
Remove the direction check in findDefinedTarget. We already to a
better direction check in canLink().

This fixes the case where a capture stream has the node.target set
to a sink. The directions don't match and the capture stream is not
linked to the monitor ports of the sink. Removing the check triggers
the right logic in canLink() and obs studio can link to monitor
ports again.
2021-11-18 11:46:47 +00:00
Wim Taymans
45fae97036 libcamera: use the new manager object for monitoring 2021-11-15 11:58:14 +01:00
George Kiagiadakis
3946457a79 release 0.4.5 2021-11-11 12:35:25 +02:00
George Kiagiadakis
a743b3f741 policy-node: don't clear peer_id when removing a link that was not for that peer
It's possible that we get multiple links on the same node, ex:

player -> output (output is the selected peer)
player -> pavucontrol

When pavucontrol exits, the peer_id of player must not be cleared,
since the link to the output still exists
2021-11-11 12:08:18 +02:00
George Kiagiadakis
4579488420 policy-node: improve debug messages in findUndefinedTarget() 2021-11-11 11:56:12 +02:00
George Kiagiadakis
eb0500f621 policy-node: fix small issues in last patch (last comment in !253) 2021-11-11 11:42:10 +02:00
Ashok Sidipotu
3122a61761 policy-node: improve target device selection logic
-loop through all the linkable nodes, instead of using default nodes
-implement a priority scheme to pick the appropriate target linkables
-If both nodes support a passthrough format, check the intersection.
 If the intersection is empty and one of the node is passthrough only,
 skip the node as a target
-the logic now closely aligns with the media-session logic

Fixes #75
2021-11-11 09:19:52 +00:00
Pauli Virtanen
0446b4fe3d wp: invalidate WpGlobal id when removed from registry
Once an object is removed from the registry, its id is invalidated and
can be later reused by other objects. WpGlobal objects may be
long-lived: e.g. those in tmp_globals may live over an add,remove,add
sequence for the same id, and a new WpGlobal must be used for the second
add. However, currently e.g. wp_registry_prepare_new_global may pick the
WpGlobal for a previously removed object from the tmp_globals list.

To address this, invalidate the WpGlobal id immediately when we get the
registry remove event.
2021-11-11 09:13:04 +00:00
George Kiagiadakis
07cd52bcb8 policy-node: check target exists before checking if an item is linked to it
Related to #102
2021-11-10 09:26:59 +02:00
George Kiagiadakis
2580b3431b policy-node: grab si.id once in createLink() and reuse it
... and avoid passing a reference to si in the closure
2021-11-09 19:09:39 +02:00
Julian Bouzas
ca7109b37b policy-node: add check to not relink more than 5 times if link with peer fails 2021-11-09 08:18:44 +00:00
Julian Bouzas
d47df77c55 policy-node: lookup the proper peer link when handling linkable
Previously, we were always looking for the first available link on the item,
which could lead to problems if the item had more than 1 link (eg target and
monitor links). Now, we keep the Id of the last target in order to determine if
the item is linked to the proper target when rescanning.
2021-11-09 08:18:44 +00:00
Peter Hutterer
b2a5b6c303 systemd: document the service files for split mode
https://gitlab.freedesktop.org/pipewire/wireplumber/-/issues/84#note_1117863
2021-11-09 16:06:12 +10:00
Julian Bouzas
4d5f9591fc policy-node: make sure 'taget.node' property has a valid Id before waiting 2021-11-03 10:37:03 -04:00
George Kiagiadakis
ff9b49064d default-routes.lua: add missing break in best route selection logic
Fixes #86
2021-11-01 12:14:04 +02:00
Julian Bouzas
0ee144a466 scripts: escape semicolon when serializing and parsing array 2021-11-01 10:00:52 +00:00
Peter Hutterer
49ca2eaebf ci: add a shellcheck job
We only have one script (wp-uninstalled.sh) but let's check that.
2021-10-26 13:06:46 +10:00
Peter Hutterer
083e10a75d wp-uninstalled: fix a few shellcheck complaints 2021-10-26 13:06:46 +10:00
George Kiagiadakis
51713d309a policy-{node,endpoint-device}: do not hold reference to si_link in closure
This may keep the link alive for longer than expected
2021-10-23 11:02:13 +03:00
Julian Bouzas
04f77a5fbc policy-endpoint-client.lua: refactor based on policy-node.lua 2021-10-21 14:03:15 -04:00
Julian Bouzas
a03995c212 policy-endpoint-device.lua: refactor based on policy-node.lua 2021-10-21 14:03:15 -04:00
Julian Bouzas
72b3be9e83 m-si-audio-endpoint: use an internal audio adapter session item
Avoids code duplication with si-audio-adapter.
2021-10-21 14:03:10 -04:00
Julian Bouzas
5c1035bab4 m-si-audio-adapter: add no-format configuration property
Makes format finding optional when configuring item.
2021-10-21 13:04:33 -04:00
Julian Bouzas
44a0c55e3d m-si-audio-endpoint: do not use virtual media class for null sink nodes
The PulseAudio layer does not recognize virtual media classes.
2021-10-20 12:50:33 -04:00
Julian Bouzas
6624eaaf3e m-si-audio-adapter: remove unused audio utilities 2021-10-20 07:41:21 +00:00
George Kiagiadakis
eff97aed6e file-monitor-api: allow watching files too, not just directories 2021-10-19 17:16:37 +03:00
George Kiagiadakis
f8ced47a1a policy-node: enforce the direction of the target when linking by node name
When node.target is set to contain a node's name, it is possible to run
into the situation where you have a sink and a source with the same name
(typically the case with module-loopback) and the sink has monitor ports,
so wireplumber may link the stream to the monitor of the sink instead of the
capture ports of the source

With this policy, if a stream really wants to link to the monitor of the sink,
it has to have the "stream.capture.sink" property set or specify the
target by id.
2021-10-19 13:04:58 +03:00
Ashok Sidipotu
e2e3c5a69c wp-factory: enumerate pw_factory objects
pw_factory objects allow permissions to be set on its clients,
wp-factory exposes this funtionality to wireplumber clients.
2021-10-19 05:46:46 +00:00
Julian Bouzas
ea229779a8 si-audio-adapter: make sure formats is valid before iterating 2021-10-18 14:33:01 -04:00
George Kiagiadakis
1bdb8c2fb3 policy-node: don't rescan in the timeout callback if the si was already destroyed 2021-10-18 13:33:07 +03:00
George Kiagiadakis
634f73eb2d policy-node: don't hold a reference to the session item in the timeout callback
... it causes the si to be kept around even after the node is destroyed
2021-10-18 13:30:20 +03:00
George Kiagiadakis
6e67000d5e si-standard-link: fix crash after returning a link error
If one link fails, the activation transition will return, but then
other links will continue to call the callback and try to access
the now invalid activation transition. With this change, the callback
is bound to the lifetime of the transition and will stop being called
after the transition returns

Fixes #76
2021-10-16 09:51:00 +03:00
George Kiagiadakis
9e11aa5b8b release 0.4.4 2021-10-15 16:54:42 +03:00
Enrean Rean
477fc744de meson: add support for compiling module-logind with elogind
Closes #71
2021-10-15 13:36:30 +00:00
George Kiagiadakis
4ab119778a policy-node: when node.target is specified, wait a bit for the target to be available
There is a chance of race condition here in case the client knows which target
it wants to link to, but wireplumber has not yet "seen" this target because
it is getting prepared asynchronously

This may stall for up to 2 seconds clients that start streams with an invalid
node.target property, but then they will be re-routed to the default node
2021-10-15 15:10:41 +03:00
George Kiagiadakis
2a21e005e0 policy-node: avoid searching for existing links if there is no reason
If the item was not already handled or if there is no target,
we don't need to search for existing links... we will not find any

Also, don't remove links or schedule rescan if the node is not eligible
for reconnection... we will delete the node below instead
2021-10-15 15:10:28 +03:00
George Kiagiadakis
b27eccb9f0 policy-node: improve debug messages 2021-10-15 15:06:34 +03:00