Commit graph

139 commits

Author SHA1 Message Date
George Kiagiadakis
bbca2ca236 monitor: update to reflect API changes in pipewire master 2019-10-07 16:30:04 +03:00
George Kiagiadakis
2e0e144f70 softdsp-endpoint/stream: remove the port proxies when they are removed on the server
When the audioconvert starts, it emits 2 ports, but when we set the PortConfig,
it removes them and re-creates them. Previously, the stream class would not
remove the old port proxies from the list and therefore they existed twice.

It is also necessary here to store the proxies earlier, when they are added,
instead of when they are augmented, so that we can ensure they are removed.
Previously we would hit an issue where:
 - port proxy is added, augmented
 - augment completes but the GTask wants to complete asynchronously:
   it stores a ref on the proxy and adds an idle source
 - server removes the proxy, we delete it from the core's list
 - the GTask now calls the augment callback, which stores the (removed)
   proxy on the stream's port_proxies list...
2019-10-02 21:33:34 +03:00
George Kiagiadakis
f360aed978 sofdsp-endpoint: run audioconvert in merge+split mode and use a new linking algorithm
Running audioconvert in merge+split mode is the only way to make this work with
the adapter, since the adapter does not support passing multiple channels on
a single port right now, and if it does at some point, it will be without a
mixing node on the port, which means we will not be able to mix multiple
audioconvert nodes on the same adapter. In the future we need to consider
writing a lighter volume node with multiple channels support to replace
audioconvert.

The new linking algorithm now takes into account the channel positions and makes
sure to link the correct channels together. Also, it avoids passing the port
proxies inside the GVariants, thus making the algorithm a bit more generic
and easier to unit test.
2019-10-02 21:27:44 +03:00
Julian Bouzas
897d94c7dd bluez: create softdsp endpoints for bluetooth nodes 2019-09-25 12:33:47 +02:00
Julian Bouzas
b9ad90f68c softdsp-endpoint: use the same number of channels in the converters as the sink/source node 2019-09-25 12:05:56 +02:00
Julian Bouzas
26fb89cb16 modules: move softdsp-endpoint inside module-pipewire 2019-09-25 10:25:49 +02:00
Julian Bouzas
5737b61c30 modules: remove simple-endpoint 2019-09-25 10:25:37 +02:00
George Kiagiadakis
50e52b9e84 modules: fix reading proxy-node out GVariants
GVariant is instructed to store a 64-bit unsigned integer (mode "t")
but we pass it a pointer to a pointer to read this value out,
which will crash in 32-bit architectures, as the pointer doesn't have
enough bits and g_variant_lookup therefore corrupts the stack.
2019-09-22 18:14:43 +03:00
George Kiagiadakis
375fa8a3dd modules: replace the monitor code from module-pw-{alsa,bluez} with module-monitor 2019-09-17 16:35:14 +03:00
George Kiagiadakis
e3ac60c0c0 modules: implement a new module-monitor
This is a generic WpMonitor loader that sets up the WpMonitor
properties from the module arguments and applies some well-known
properties to the device & node objects
2019-09-17 16:35:14 +03:00
George Kiagiadakis
a63f2bb99b lib/wp: merge both WpRemote & WpRemotePipewire in WpCore
In practice we always create a remote and connect to pipewire.
Any other scenario is invalid, therefore, it is not justified
to be confused with so many classes for such small functionality.
This simplifies a lot the modules code.

Also, this commit exposes the pw_core and pw_remote objects
out of WpCore. This is in practice useful when dealing with low-level
pw and spa factories, which are used in the monitors. Let's not
add API wrappers for everything... Bindings will never use this
functionality anyway, since it depends on low level pipewire C API.
2019-09-07 17:55:46 +03:00
George Kiagiadakis
84b752e304 simple-endpoint: use WpProperties instead of parsing the spa_dict from the info structure 2019-09-07 11:30:08 +03:00
George Kiagiadakis
bf9cecd129 Merge branch 'master' into proxy-refactoring 2019-09-07 11:22:50 +03:00
George Kiagiadakis
95665a3496 mixer: search for "Alsa/Sink" instead of "Audio/Sink" now
Since the alsa endpoints class was renamed...
2019-09-05 15:26:29 +03:00
Julian Bouzas
fd8414aad1 bluez: handle all bluetooth profiles 2019-09-02 09:56:42 -04:00
George Kiagiadakis
72e13919a4 bluez: warn if the SPA bluez plugin is not installed instead of asserting 2019-08-29 21:23:20 +03:00
George Kiagiadakis
ac7086d156 modules: port to new WpProxy API 2019-08-29 21:21:33 +03:00
Julian Bouzas
770fe8c703 simple-policy: handle bluez endpoints 2019-08-28 14:19:22 -04:00
Julian Bouzas
ad8491df44 modules: destroy all alsa/bluez nodes when an alsa/bluez device is removed 2019-08-28 14:19:22 -04:00
Julian Bouzas
c473cecbed bluez: cleaned module and set media class to Bluez/<direction>/<profile> 2019-08-28 14:19:16 -04:00
Julian Bouzas
23cc1edc28 alsa-udev: cleaned module and set media class to Alsa/<direction> 2019-08-28 11:10:11 -04:00
Julian Bouzas
dcbf823a5a endpoint: add direction property and remove it from subclasses 2019-08-27 10:05:59 -04:00
Julian Bouzas
9a6e520721 bluez: create bluetooth endpoints 2019-08-26 11:31:38 -04:00
Julian Bouzas
5ff06a97f7 simple-endpoint: add direction property 2019-08-26 11:25:53 -04:00
Julian Bouzas
de97be850a adapter: do not use hardcoded format 2019-08-26 10:31:44 -04:00
Julian Bouzas
6786b13fdc bluez: add new module to monitor bluetooth devices 2019-08-19 10:42:03 -04:00
George Kiagiadakis
d4f882d731 Update for the pw_global "parent" concept removal 2019-08-19 15:24:00 +03:00
Julian Bouzas
fbf8de84fa modules: replace dsp class with stream, adapter and convert classes 2019-08-15 14:35:59 -04:00
Julian Bouzas
8d58243fa6 module-pw-alsa-udev: start the alsa monitor and create the alsa nodes 2019-08-13 14:26:38 -04:00
Julian Bouzas
759aa450af remove remote-endpoints and use the new pipewire API 2019-08-13 14:26:38 -04:00
Julian Bouzas
7d4c9fa6e2 simple-policy: select the client's target name endpoint 2019-08-13 14:26:38 -04:00
Julian Bouzas
d49ed2b3f4 simple-endpoint: add target property 2019-08-13 14:26:38 -04:00
Julian Bouzas
96d940e94e softdsp-endpoint: always set name and check for alsa api when giving proper alsa name 2019-08-13 14:24:31 -04:00
George Kiagiadakis
0002722289 simple-policy: compare client creation times so that the "last one wins"
When two clients have the same role, the current policy should
favor the newest client.
2019-07-30 14:05:40 +03:00
George Kiagiadakis
b05ae5f09c simple-policy: do not leak client endpoints when rescanning 2019-07-30 13:17:58 +03:00
Julian Bouzas
c27c020a66 simple-endpoint-link: skip already output linked ports 2019-07-25 12:27:40 +03:00
George Kiagiadakis
4b6ea0de6e modules: initialize some spa_pod_builders inline 2019-07-25 12:27:34 +03:00
Julian Bouzas
9f07ba229c dsp: removed unneeded format property and always use the default format 2019-07-25 12:26:42 +03:00
Julian Bouzas
efbefe9e0e simple-policy: fix bug when finding endpoints 2019-07-25 12:24:48 +03:00
Julian Bouzas
755f0bd862 modules: handle error if the endpoint proxies could not be created 2019-07-25 12:24:47 +03:00
Julian Bouzas
3fc9582b6a dsp: use the new WpProxyLink API 2019-07-15 11:05:34 -04:00
George Kiagiadakis
eaaa9f7f35 simple-policy: remove the idle callback when the object finalizes
Avoids crashing if a rescan is scheduled but the policy module is
destroyed in the meantime
2019-07-12 19:43:07 +03:00
George Kiagiadakis
1ed004c3c1 policy: implement a basic policy based on role priorities
* Every client has a priority based on its role
* For playback, we allow only a single client to play at a time
* For capture, we allow all clients to capture simultaneously
* Every time the "selected" device changes (either because devices
  are discovered/removed or because the user changed the selection),
  the clients are re-linked to the new "selected" device.
* When a playback client quits and there are others waiting unlinked,
  the highest priority one is linked automatically.
* This also properly fixes re-linking the correct client(s) to the
  correct device(s) when wireplumber exits and restarts.
2019-07-12 19:28:27 +03:00
Julian Bouzas
536df13709 simple-policy: delay unhandled enpoints if target is not found 2019-07-12 09:44:32 -04:00
Julian Bouzas
1a02bfef8a audio-client-module: added new module to load clients after softdsp endpoints are created 2019-07-12 09:44:15 -04:00
George Kiagiadakis
a2bf7e3999 policy: take into account the role of the client when linking it
This allows linking the client to the stream that has the same name
as the role that it requests.
2019-07-12 14:40:19 +03:00
George Kiagiadakis
10f8eff99c m-client-permissions: ref-count the client data and re-work code for safety
It so happens that sometimes the client proxy is created and destroyed
immediately, almost instantly, which causes this code to crash in case
the proxy pointer is gone when our idle callback tries to destroy it.

This change makes the whole operation safe.
2019-07-11 17:19:14 +03:00
Julian Bouzas
51facef4e4 simple-policy: unlink the target endpoint if it is already linked 2019-07-10 11:18:09 -04:00
Julian Bouzas
1b69ef8339 simple-endpoint-link: store the created links in a list 2019-07-10 11:18:09 -04:00
Julian Bouzas
3cecccd681 endpoint: allow derived classes of endpoint-link to finish async construction 2019-07-10 11:18:09 -04:00