Commit graph

47 commits

Author SHA1 Message Date
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
2af63b20df si-standard-link: return transition error once even if multiple links failed 2021-12-13 08:37:07 -05: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
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
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
George Kiagiadakis
5dcd06c339 policy-node: implement encoded audio passthrough
* also respect node.exclusive
* also send error to clients if a target node was not found
  or if it is not possible to link to it
* also allow dont-reconnect nodes to be handled normally
  the first time they appear, until they are linked once
2021-10-13 12:48:03 +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
Julian Bouzas
133249399a m-si-standard-link: refactor and add support for no DSP mode
We always use the output session item mode and format when configuring adapters,
unless the input session item is a device node and the output session item is
not a device node.
2021-09-29 14:03:27 -04:00
Julian Bouzas
02fd0a554a m-si-standard-link: make link_all a parameter
Otherwise its value will always be false, making it useless
2021-06-25 08:50:08 -04:00
George Kiagiadakis
558ab50367 si-standard-link: treat endpoints as devices when linking stream<->endpoint
This avoids reconfiguring endpoint nodes when re-linking streams
to their endpoint after having been corked by the policy.

This is not ideal, the logic here needs some refinement.
2021-06-10 14:53:09 +03:00
Wim Taymans
72d8778e3f si-adapter: handle dont-remix streams
Don't-remix streams don't change their channel mapping based on
the device they connect to but are always configured with their
default channel mapping, just like devices.

This fixes the gnome-control-center channel test.

This patch also removes the 1 channel -> many patch because it is
not the right thing to do in this case and should be implemented
with some proper channel mapping patch later.
2021-06-07 09:56:54 +02:00
George Kiagiadakis
bf9d4c4ed7 m-si-standard-link: fix number of links check
self->node_links is a GPtrArray*
2021-05-27 17:01:00 +03:00
Julian Bouzas
bd90783398 m-si-standard-link: remove unused manage.lifetime configuration property 2021-05-24 11:07:59 -04:00
George Kiagiadakis
ac9e1e89c4 wp: remove WpSession and WpEndpointLink
We have ended up not using them, so let's not carry them
in the ABI of 0.4

We can always revert that, but let's first decide how
these objects should be used
2021-05-21 19:57:31 +03:00
Julian Bouzas
e1faf3f095 si-standard-link: configure the format in WpSiAdapters before linking 2021-05-12 10:37:18 -04:00
Julian Bouzas
47ae4f28a3 si-standard-link: make sure create_links creates at least 1 link 2021-05-11 10:56:50 -04:00
Julian Bouzas
d68636f9b3 si-interfaces: rename WpSiPortInfo to WpSiLinkable 2021-05-11 10:56:44 -04:00
Julian Bouzas
2caac5fa87 si-standard-link: call parent class finalize once finalized 2021-04-07 13:21:40 -04:00
Julian Bouzas
552b04ed7d m-si-standard-link: properly set in item port context when configuring 2021-04-06 14:04:34 -04:00
Julian Bouzas
fb1daa0bf2 modules: use dots instead of dashes for session item properties
Keeps consistency with PipeWire
2021-04-02 11:22:22 -04:00
Julian Bouzas
75d53dbef3 m-si-standard-link: make sure in/out items are valid before activating 2021-03-31 10:51:20 -04:00
Julian Bouzas
0d71565d63 m-si-standard-link: set out-item-id and in-item-id properties 2021-03-26 16:16:02 -04:00
Julian Bouzas
ebf52adb21 si-interfaces: make WpSiLink work with WpSiPortInfo instead of WpSiEndpoint 2021-03-26 16:16:02 -04:00
Julian Bouzas
64cf2bd644 si-interfaces: rename WpSiEndpointAcquisition to WpSiAcquisition
The get_endpoint_acquisition() vmethod has also been moved to WpSiPortInfo, and
therefore renamed to get_acquisition().
2021-03-26 16:16:02 -04:00
Julian Bouzas
13fc0adb22 m-si-standard-link: use a weak reference for in and out endpoints
Allows checking if the endpoints are still valid before releasing the
acquisition. Sometimes the endpoints are destroyed before the link, and
releasing acquisition is not needed. There is no way to check that with raw
pointers.
2021-03-26 16:15:38 -04:00
Julian Bouzas
0bef8280d7 m-si-standard-link: fix in-endpoint check when configuring 2021-03-26 15:56:07 -04:00
Julian Bouzas
120aab04ae session-item: refactor and inherit from WpObject
This adds WP_SESSION_ITEM_FEATURE_ACTIVE and WP_SESSION_ITEM_FEATURE_EXPORTED
features, so _activate and _export APIs have been removed. Modules and unit
tests have also been updated.
2021-03-18 14:30:05 -04:00
Julian Bouzas
12b2c00d0b lib: remove WpEndpointStream API
Add all that goes with it.
2021-03-18 12:10:37 -04:00
George Kiagiadakis
0d072874a1 lib: introduce WpComponentLoader and remove WpModule
The component loader is a more generic and extensible mechanism
of loading components; modules are one type of component...
The idea is to make scripts and config files also be components,
loaded by plugins that inherit WpComponentLoader
2021-02-03 17:16:51 +02:00
George Kiagiadakis
ccdc354445 modules: port modules and their tests to the new proxy APIs
Disable m-session-settings for now, as it needs further work
2020-11-15 20:26:15 +02:00
George Kiagiadakis
aabf6beda7 si-convert: use passive links
Requires PipeWire < 0.3.3 or > 0.3.6 to actually work
2020-06-17 14:44:29 +03:00
George Kiagiadakis
244fa28d17 si-standard-link: allow linking MONO capture clients
In case we have a multi-channel capture device and a mono client,
treat the MONO port as UNKNOWN and let it link with the first
port available on the device

Easy to test with arecord, which by default captures in MONO
2020-06-17 12:55:12 +03:00
George Kiagiadakis
e944abbcd5 si-standard-link: associate links with endpoint-links 2020-06-02 13:09:00 +03:00
Julian Bouzas
6a73179d57 si-standard-link: fix memleak when creating links 2020-05-19 10:18:51 -04:00
Julian Bouzas
e481c998a4 si-standard-link: check if stream parent is valid before acquisition 2020-05-15 08:21:49 -04:00
Julian Bouzas
7e8e6da857 si-standard-link: get the core from the stream node when its endpoint link proxy is not valid 2020-05-12 09:47:27 -04:00
George Kiagiadakis
c02bff50cd si-standard-link: add options to use different port contexts 2020-05-07 16:48:06 +03:00
George Kiagiadakis
cc72b3757c si-standard-link: manage lifetime internally 2020-05-07 16:38:14 +03:00
George Kiagiadakis
7966a8d456 si-standard-link: fix endpoint linking bugs and add some debug statements 2020-05-05 18:04:05 +03:00
Julian Bouzas
791e9170aa si-interfaces: transfer full when returning from _get_stream_parent_endpoint 2020-05-03 19:54:31 +03:00
George Kiagiadakis
d61b7904f9 modules: fix small issues in the session items 2020-04-23 15:22:32 +03:00
George Kiagiadakis
49b63b6045 session-item: refactor export to use a process similar to activate
+ expose the export transition in the session item class
+ make the export-related flags immutable
+ add an export error flag
+ update and improve documentation
2020-04-16 17:38:31 +03:00
George Kiagiadakis
441a778b2e session-item: introduce a rollback() virtual method
+ replace calling execute_step(..., STEP_ERROR) with rollback
+ implement deactivate internally using rollback

This unifies deactivation steps, which are common between deactivate()
and calling execute_step() with WP_TRANSITION_STEP_ERROR at the
end of a failed activation transition.
2020-04-16 13:18:21 +03:00
George Kiagiadakis
6b51e5842c tests: add session-item unit test 2020-04-16 11:55:23 +03:00
George Kiagiadakis
0e855d854a modules: implement si-standard-link, the default WpSiLink implementation 2020-04-11 11:05:09 +03:00