Commit graph

1652 commits

Author SHA1 Message Date
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
Pauli Virtanen
2db8c0a288 bluez5: fix initial profile selection
Currently, spa-bluez5 devices start in non-off profile, which causes
m-device-activation logic to set the highest priority profile instead of
the saved one.

Fix this by having spa-bluez5 start devices in off profile, similarly as
spa-alsa does.
2022-01-24 07:32:22 +00:00
Julian Bouzas
411378d9fd spa-pod: add missing API sentinel 2022-01-21 13:59:03 +00:00
Wim Taymans
3239c03e2f lib: assert non-NULL input for wp_spa_pod_equal
It should not be called with NULL values or it'll crash.
2022-01-21 13:55:26 +00:00
Wim Taymans
7d4369c1af tests: don't leak fd in test 2022-01-21 09:45:29 +01:00
Wim Taymans
0c3be71ceb conf: update module-rt usage in bluetooth.conf
We now only use module-rt. Explicitly set the nice.level to -11 instead
of leaving the default (do nothing). Adjust the rt limits to their new
defaults in module-rt (unlimited).
2022-01-19 12:22:58 +01:00
George Kiagiadakis
c22fbe9ad0 docs: actually mention correct numbers in the priority.session note 2022-01-19 12:57:34 +02:00
George Kiagiadakis
f84778ff8e docs: add a note about good priority values for nodes
Related to #145
2022-01-19 12:29:12 +02:00
Wim Taymans
9100064446 conf: update module-rt usage
We now only use module-rt. Explicitly set the nice.level to -11 instead
of leaving the default (do nothing). Adjust the rt limits to their
defaults in module-rt.
2022-01-18 13:34:23 +01:00
Sanchayan Maity
ef7504bdc8 scripts: policy-bluetooth: Support saving of user selected headset profile
The "saved headset profile" is taken as the profile that was active when
the headset mode deactivates. So in case the user switches profile during
the time when the Communication input stream is active, the selected
profile is remembered next time.
2022-01-14 16:49:27 +00:00
Sanchayan Maity
99d0fa3196 scripts: Add a bluetooth policy script
Allow switching bluetooth profile based on presence of media.role or
a list of specified applications.
2022-01-14 16:49:27 +00:00
Sanchayan Maity
5fba8af1e6 scripts: intended-roles: Use both device and stream
When a stream gets added, we might have a situation where the device
does not yet exist to actually link on the basis of intended role. For
example this can be observed if no mic sources are present and then the
mic appears after a bluetooth profile switch to HFP.

To fix this, iterate over streams when a device connects in addition to
iterating over devices when a stream connects.
2022-01-14 16:49:27 +00: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
George Kiagiadakis
afb177b5e0 release 0.4.7 2022-01-13 11:27:44 +02:00
George Kiagiadakis
18bc3d3596 scripts: fallback to empty config table if args were not passed from the config files
Fixes #158
2022-01-13 11:10:03 +02: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
mazunki
bbd23fa3e3 added support for disabling nodes and devices through conf 2022-01-12 13:07:05 +00: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
40b16974cf scripts: monitors: log warning if spa devices were not created successfully
Can happen if the user does not have the specific spa pluging installed.
2022-01-12 10:09:56 +00: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
Ashok Sidipotu
2e23d82779 policy-endpoint-client.lua: fix record with endpoints
The Role traversal of config data to take notice of the
media class as well so that source and sink roles dont
overstep on each other and pick up unexpected endpoints.
2022-01-11 15:31:40 +05:30
Ashok Sidipotu
99dfa7d38a config: update the endpoints config
-Sync endpoints config from AGL.
-Add a capture endpoint.
2022-01-11 15:30:30 +05:30
Julian Bouzas
bc76cb7d74
spa-pod: fix different architecture errors for boolean values 2022-01-09 10:22:47 +02:00
Julian Bouzas
bee9827ae3 policy-node: find best linkable if default one cannot be linked
Fixes issue with echo cancellation pipewire module.
2022-01-08 15:14:44 +00:00
Julian Bouzas
afe71d7e48 policy-node: schedule a rescan without timeout if defined target is not found
Fixes #146
2022-01-08 06:48:16 +00:00
Julian Bouzas
23fc4d21a9 policy-node: fix typo when finding best target 2022-01-07 10:12:04 -05:00
George Kiagiadakis
9a733293d7 release 0.4.6 2022-01-06 18:11:51 +02: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
George Kiagiadakis
3f3c9802d6 create-item: downgrade warning to message
This is expected to be printed if a stream opens and closes
very quickly, like in the case of pipewire-alsa opening the device
for querying formats and then closing it immediately.
2022-01-05 18:13:41 +02:00
George Kiagiadakis
1c85139640 bump pipewire dep to 0.3.43
we now need it for spa_json_parse_stringn()
2022-01-05 18:13:10 +02: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
6adccbe33d policy-node: always use the default linkable if default nodes module is loaded
If the default nodes module is loaded, and the default node is not found, it
means that there is no valid target for that session item. We only need to
manually find a default target if the default nodes module is not loaded.
2022-01-05 08:57:33 +00: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
Jonas Holmberg
e1602c10c5 policy-node.lua: Fix nil value indexing
Fixes the warning:

[string "policy-node.lua"]:117: attempt to index a nil value (field '?')
stack traceback:
  [string "policy-node.lua"]:117: in function <[string "policy-node.lua"]:109>
2022-01-05 07:04:09 +00:00
George Kiagiadakis
dc50f95910 config: add commented-out "session.suspend-timeout-seconds" option in alsa config
For the sake of discovering this more easily
2022-01-05 08:28:52 +02:00
George Kiagiadakis
03c2a3dfbd suspend-node: use a 5sec timeout by default, to be inline with the docs 2022-01-05 08:28:52 +02:00
George Kiagiadakis
74bac56aed docs: update documented versions of dependencies 2022-01-05 08:28:52 +02:00
George Kiagiadakis
a65f17d6fa docs: update the "running" instructions 2022-01-05 08:28:52 +02:00
George Kiagiadakis
1da5d11317 docs: split up and enrich configuration docs
* Add information about multiple instances
* Document better how the lua config files work
* Document how lua config files get merged from different places
* Copy over additional documentation for ALSA from pw-media-session
* Fix rst syntax issues
2022-01-05 08:28:52 +02: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
Wim Taymans
071ad0e43f config: add property for audio.allowed-rates 2022-01-03 16:05:17 +01:00
George Kiagiadakis
64841f5ada config: enable RT on the data thread for bluetooth nodes
Closes #132
2022-01-03 13:36:49 +02:00
George Kiagiadakis
e04acbd2a0 docs: remove protected annotations from functions to show them in the docs 2021-12-22 17:09:20 +02:00
Julian Bouzas
a59dc92928 policy: use a scheduleRescan function to avoid unneeded rescans 2021-12-22 16:52:16 +02:00