Commit graph

21 commits

Author SHA1 Message Date
Ashok Sidipotu
eba3d9d6f8 policy-endpoint-client.lua: avoid connecting filters to endpoints
Equalizer Node or filter nodes are considered as regular linkable and
its output is connected to endpoint. Prevent this by skipping over
filter nodes in this script.
2023-11-22 08:22:59 +00:00
Pauli Virtanen
c6aa44ca26 policy-node/create-item: fix handling of linkables pending activation
Policies need to know if there are session items that are pending
activation. Linkables are not activated in the same order as nodes
appear, which causes problems for e.g. resolving target nodes, if some
of the linkables are pending.

Register linkables in create-items before they are activated.  When
activation completes, remove those that did not activate successfully.
Policies can filter out inactive items by tracking active-features
flags.

If there are existing linkables that are not ready, suspend policy-node
processing, and continue it only after all linkables are ready.
2022-02-20 21:59:39 +02:00
Julian Bouzas
e495d4920d policy-endpint: add support for stream audio nodes without media.role
If a stream audio node does not have the 'media.role' property set, the policy
will asign the 'Default' media role name to it. In addition to this, if the
'Default' endpoint can not be found, the policy will link the stream audio node
with the lowest priority endpoint.

Video nodes will always be handled by policy-node.lua, and they will never be
handled by policy-endpoint-client.lua

This allows users to assign a particular endpoint for streams that don't have
the 'media.role' property set.
2022-02-02 11:37:00 -05: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
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
Julian Bouzas
a59dc92928 policy: use a scheduleRescan function to avoid unneeded rescans 2021-12-22 16:52:16 +02:00
Julian Bouzas
04f77a5fbc policy-endpoint-client.lua: refactor based on policy-node.lua 2021-10-21 14:03:15 -04:00
George Kiagiadakis
8671b495be policy-endpoint-client: decrease log message verbosity 2021-10-08 00:26:41 +03:00
George Kiagiadakis
e76c67c45c policy: refactor/improve policy-node & session items to fix linking to monitors
* populate most session item properties from create-item.lua to keep
  things more compact and readable
* use a standard naming scheme for the session item properties
* use session item properties instead of node properties in policy-node.lua
* improve policy-node's performance by converting the properties dictionary
  less times for each session item
* refactor some policy logic and make things slighly more readable
* change the accepted values for 'context' in wp_si_linkable_get_ports();
  use "input" and "output" to keep things clear, because the previous use
  of NULL and "reverse" were implying that a node has only one "standard"
  direction, but this is complicated for sinks w/ monitors and duplex nodes
* allow using monitors (which are Audio/Sink nodes in fact) as sources
* treat Audio/Duplex nodes as sinks, like p-m-s does
* respect the "stream.capture.sink" property of streams

Fixes #66
2021-10-08 00:26:41 +03:00
George Kiagiadakis
4cdfeb9c32 scripts: change debug level for some messages 2021-06-10 14:53:08 +03:00
George Kiagiadakis
917cef25d8 policy: don't crash if some node properties are not set
- sanitize printing properties with tostring(), which will properly
  convert nil values to the string "nil"
- ensure some properties become empty strings if they are nil
2021-06-04 18:36:19 +03:00
George Kiagiadakis
7c8b91c94e policy-{node,endpoint-client}: do not crash if media.class is nil 2021-05-28 18:44:11 +03:00
Julian Bouzas
bd90783398 m-si-standard-link: remove unused manage.lifetime configuration property 2021-05-24 11:07:59 -04:00
Julian Bouzas
0ff0ef77f2 policy: reevaluate all linkables if one linkable was removed
Allows relinking client nodes to other devices if the current device has been
removed. This allows audio to keep playing in a different device if a bluetooth
device is disconnected.
2021-05-20 11:18:15 -04:00
Julian Bouzas
f0166d6b3c policy: fix removing of item links when linkable is removed 2021-05-13 08:46:02 -04:00
Julian Bouzas
d68636f9b3 si-interfaces: rename WpSiPortInfo to WpSiLinkable 2021-05-11 10:56:44 -04:00
Julian Bouzas
ee121e3093 scripts: cleaned and improved policy scripts
The policy scripts can handle now client nodes that want to be linked with other
client nodes. This is needed for nodes created by the Pulse Audio Volume Control
to monitor audio comming from other application client nodes.
2021-05-10 15:24:40 -04:00
George Kiagiadakis
d1da39b4f6 policy-endpoint-client: remove handling of move & follow and endpoint priorities
These don't make much sense here. In the endpoint policy we want
the clients to be linked to the endpoint that matches their role
and never move.

Also, endpoint priorities are useless. If no endpoint matches the
role, then just ignore the client.
2021-04-15 18:14:25 +03:00
George Kiagiadakis
155ad32212 scripts: add policy for links between clients and endpoints
This script takes links that are created by policy-endpoint-client
and activates only the ones that should be active based on role
priorities
2021-04-13 19:37:06 +03:00
George Kiagiadakis
45e0ad1092 policy: export endpoints, do not export endpoint links
As with endpoint streams, there is not much use for endpoint links
in this updated design. This will be re-evaluated.
2021-04-12 12:48:48 +03:00
Julian Bouzas
5c6d484d08 src: scripts: rename policy-endpoint.lua to policy-endpoint-client.lua 2021-04-09 14:21:03 -04:00
Renamed from src/scripts/policy-endpoint.lua (Browse further)