Commit graph

690 commits

Author SHA1 Message Date
Wim Taymans
afbc0ce57a si-audio-adapter: relax format parsing
Some nodes can omit the format/rate/channels to indicate that they can
deal with all possibilities and adapt to what they are linked to.

See pipewire#876
2022-02-25 16:47:09 +00:00
Julian Bouzas
b3446efa16 config: port device-activation module to policy-device.profile.lua
Because all wireplumber policies are in Lua.
2022-02-16 13:37:40 -05:00
George Kiagiadakis
ca906362cd lua-scripting: expose WpImplMetadata on the API 2022-02-03 13:04:55 +02:00
Julian Bouzas
b1b603443f restore-stream: use the new Json API and remove route-settings-api module 2022-02-02 18:37:39 +00:00
Julian Bouzas
384c5775f8 default-nodes: add option to auto-switch to echo-cancel nodes
This option is enabled by default now.
2022-01-27 14:55:21 -05:00
Julian Bouzas
b0ddd6f890 m-lua-scripting: add Json.Raw constructor 2022-01-26 09:53:24 -05:00
Julian Bouzas
46ab414a04 spa-json: fix coverity scan issues 2022-01-25 21:18:16 -05:00
Julian Bouzas
5bef0f240f default-nodes: use WpSpaJson API 2022-01-25 07:40:59 -05:00
Julian Bouzas
20187e07b5 m-lua-scripting: add WpSpaJson API 2022-01-25 07:20:35 -05:00
Julian Bouzas
95e7c4abe8 m-default-nodes-api: add API to get and set default configured node name 2022-01-25 09:57:33 +00:00
Julian Bouzas
10531e95b5 default-nodes: reevaluate when device params changed
Some devices have different nodes for speakers and headphones. In that scenario,
this change notifies the policy to re-link all clients to the new default node
when the user plugs and unplugs the headset.
2022-01-24 16:18:31 -05:00
George Kiagiadakis
93d3051966 Revert "default-nodes: increase priority if node has available routes"
This reverts commit ad80faaa8d.

The same issue is fixed by the intermediate commit by Wim. Let's revert
this to keep the logic in-sync with policy-node.lua and media-session.
2022-01-14 17:55:24 +02:00
Wim Taymans
211f1e6b6c default-nodes: handle nodes without Routes
When a node has not part of any EnumRoute, we must assume it is
available.

Fixes selection of Pro Audio nodes as default nodes.
2022-01-14 16:32:04 +01:00
Julian Bouzas
ad80faaa8d default-nodes: increase priority if node has available routes
Fixes #163
2022-01-14 09:15:08 -05:00
Julian Bouzas
8844cfb074 device-activation: show device name in logs 2022-01-12 19:27:17 -05:00
Julian Bouzas
b4245d64c5 default-nodes: add more logs 2022-01-12 19:26:49 -05:00
Julian Bouzas
75281d8681 default-nodes: check if default node has available route
Fixes #145
2022-01-12 07:16:08 -05:00
Julian Bouzas
07a0a5b404 default-nodes: check if the ports exist in rescan_om
Ports might not be ready in the node's port object manager yet.

Fixes #153 and #150
2022-01-12 09:48:36 +00:00
Julian Bouzas
0d008dce75 m-default-nodes-api: don't return stream node if default node name matches
Stream nodes can never be default nodes, so we skip them in case they have the
same name as the actual default node.

Fixes #130
2022-01-06 06:50:32 +00:00
Julian Bouzas
a1423a4b1f m-device-activation: reset iterator when finding best and default profiles
Avoids possible issue when finding best profile when default is not found.
2022-01-05 08:54:12 -05:00
Corentin Noël
b6dd422dd2 si-audio-adapter: Reference WpTransition before passing it as callback data
Make sure to always have a valid WpTransition when used in the finish callback.

Signed-off-by: Corentin Noël <corentin.noel@collabora.com>
2022-01-05 10:28:33 +01:00
Julian Bouzas
f7dfb90db6 module-default-nodes-api: sync with core before emitting changed signal
This makes sure pipewire is not doing anything while emitting changed signal.
2022-01-05 08:57:33 +00:00
Julian Bouzas
8bbbba23ff m-default-nodes: don't reevaluate nodes if they are not ready
This makes sure nodes are ready before finding the default node, avoiding audio
glitch in wrong device if profile was also changed while changing the default
node (can happen with Gnome Sound Settings).

Since nodes are destroyed and recreated again when a device profile changes, the
only way to make sure device nodes are ready is to check the profile classes
structure, which tell us how many total nodes the device has, and then check
that those nodes exist for that device. A rescan is triggered whenever devices,
nodes or ports changed.

This patch also improves the logic when finding default nodes, allowing virtual
sources to be set as default sources.

Fixes #85 and #130
2022-01-05 08:57:33 +00:00
Julian Bouzas
76a61e43a5 m-default-nodes: set effective node metadata to NULL if node is not found
There might not be any node at all, so we need to clear the efective node
metadata.
2022-01-05 08:57:33 +00:00
Wim Taymans
4896ad0680 json: improve json parsing
spa_json_get_string() will never write more than maxlen.
Use spa_json_parse_stringn() to perform destination length checking.
2022-01-04 16:36:15 +01:00
George Kiagiadakis
f3f063760c si-std-link: handle node destroy events while linking is in progress
This should solve issues with stale objects lying around, printing
warnings and in some cases also crashing things

Related to #128, #78
2021-12-22 16:12:04 +02:00
Julian Bouzas
f8d60fcecd m-device-activation: reevaluate current profile if params changed
This also uses the same reevaluation logic as pipewire-media-session.

Fixes #98 and #118
2021-12-20 09:54:05 +00:00
Julian Bouzas
4997e2eb19 m-default-profile: only store the default profile if the save flag is present
Also refactors module to use params-changed signal.
2021-12-20 09:54:05 +00:00
Julian Bouzas
86d85584b2 m-mixer-api: unset iterator value before breaking or returning from loop 2021-12-20 09:54:05 +00:00
Julian Bouzas
2af63b20df si-standard-link: return transition error once even if multiple links failed 2021-12-13 08:37:07 -05:00
iczero
a452250b47 scripts: also look in $XDG_CONFIG_HOME/scripts 2021-12-06 14:47:49 +00:00
Julian Bouzas
e3a161273d m-device-activation: set best profile if default is not available 2021-12-06 12:10:41 +00:00
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
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
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
Julian Bouzas
ea229779a8 si-audio-adapter: make sure formats is valid before iterating 2021-10-18 14:33:01 -04: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
Enrean Rean
477fc744de meson: add support for compiling module-logind with elogind
Closes #71
2021-10-15 13:36:30 +00:00
George Kiagiadakis
11f9433929 si-audio-adapter: skip reconfiguring if the same mode & format are requested 2021-10-14 18:31:54 +03:00
Wim Taymans
486288363b si-standard-link: fix aux channels links
AUX channels can link to any other channel but when AUX channels are
linked, they must match exactly.

Fixes some issues with split devices with aux channels.
2021-10-14 16:28:51 +02:00
George Kiagiadakis
90d6e6042e si-standard-link: do not crash if an output port has no input port to link to
... and also do not link multiple output ports to the same input port
2021-10-14 17:16:50 +03:00
George Kiagiadakis
1db706990c si-standard-link: refactor linking logic to correctly link unpositioned nodes
"unpositioned" nodes don't have a specific channel layout
(ex the Pro Audio profile); in that case, we should not try to copy this
undefined layout to the peer node, we need to configure both in their
preferred layout and do a best-effort linking of ports.
2021-10-14 16:38:49 +03:00
Ashok Sidipotu
784c405c31 wp: support loading optional modules
-some modules will not be available during runtime, due to
  external dependencies.
 -these modules can now be marked optional.
 -loading of these optional modules will be attempted and if
  they are not available, wp will recover and will not be
  terminated.
2021-10-14 06:27:53 +00:00
Nicolai Syvertsen
27a6970de5 lua/api: fix impl_module_new arg parse 2021-10-13 17:25:51 +00:00