Commit Graph

30 Commits

Author SHA1 Message Date
George Kiagiadakis
4ad4974f27 endpoint-link: ensure we call finalize of the parent class
This was causing a memory corruption and crash because the
simple-endpoint-link was not calling finalize of the endpoint-link
and the GWeakRefs pointing to the endpoints were not uninitialized,
causing g_object_unref later to try to write to them (on free'ed memory)
2019-11-16 11:40:02 +02:00
George Kiagiadakis
e7e5c66853 lib: introduce WpObjectManager
* rework how global objects are stored in the core
* rework how users get notified about global objects
  and proxies of remote global objects

The purpose of this change is to have a class that can manage
objects that are registered in the core or signalled through the
registry. This object can declare interest on certain types
of global objects and only keep & signal those objects that it is
interested in. Additionally, it can prepare proxy features and
asynchronously deliver an 'objects-changed' signal, which is
basically telling us that the list of objects has changed.

This is useful to simplify port proxies management in WpAudioStream.
Now the stream object can declare that it is interested in ports
that have "node.id" == X and the object manager will only maintain
a list of those. Additionally, it will emit the 'objects-changed'
signal when the list of ports is complete, so there is no reason to
do complex operations and core syncs in the WpAudioStream class
in order to figure out when the list of ports is ready.

As a side effect, this also reduces resource management. Now we
don't construct a WpProxy for every global that pipewire reports;
we only construct proxies when there is interest in them!

Another interesting side effect is that we can now register an
object manager at any point in time and get immediately notified
about remote globals that already exist. i.e. when you register
an object manager that is interested in nodes, it will be immediately
notified about all the existing nodes in the graph. This is useful
to avoid race conditions between connecting the signal and objects
beting created in pipewire
2019-11-13 15:49:39 +02:00
George Kiagiadakis
d39307ee70 lib/wp: move internal functions and declarations to a private.h header 2019-11-07 20:44:55 +02:00
Julian Bouzas
44bb78fcb7 endpoint: add creation-time property 2019-11-06 12:15:11 +02:00
Julian Bouzas
dcbf823a5a endpoint: add direction property and remove it from subclasses 2019-08-27 10:05:59 -04: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
54721da7c4 Fix doc warnings 2019-07-12 08:20:08 -04:00
Julian Bouzas
27a31498c0 endpoint: add wp_endpoint_unlink API 2019-07-10 11:18:09 -04:00
Julian Bouzas
5d1397cf56 endpoint: destroy the link before removing them from the lists 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
Julian Bouzas
5429d57cb1 endpoint-link: make contruction async 2019-06-28 12:33:00 -04:00
Julian Bouzas
495a74d0e6 endpoint: remove unneeded ref/unref 2019-06-26 12:36:59 -04:00
Julian Bouzas
4333c94531 endpoint: add async initable interface boilerplate 2019-06-24 10:52:02 -04:00
George Kiagiadakis
ca1453febd endpoint: add some useful API for querying info about streams & controls 2019-06-18 17:42:06 +03:00
George Kiagiadakis
e603ed4215 lib: add some debug statements to debug the destruction sequence 2019-06-18 10:33:38 +03:00
George Kiagiadakis
ab73fd6eb0 endpoint: maintain a weak ref to the core since construction time
+ add a method to retrieve the core
+ change the register function to not require the core as a parameter
2019-06-18 09:23:40 +03:00
George Kiagiadakis
45dc9786f4 endpoint: ref the endpoint while unregistering
The core may be the last object holding a reference to the endpoint,
so the unregister call may destroy it.
2019-06-11 12:49:11 +03:00
Julian Bouzas
cad748ae91 endpoint: set core to null after unregistering endpoint and not before 2019-06-06 12:51:05 -04:00
George Kiagiadakis
36bc1795ca Relicense to MIT 2019-05-31 12:13:12 +03:00
Julian Bouzas
dcf749bd40 endpoint: fix bug when linking endpoints 2019-05-30 10:22:04 -04:00
George Kiagiadakis
3aa7d6ce78 lib: remove the session-manager object and register endpoints as globals 2019-05-26 19:21:27 +03:00
George Kiagiadakis
bf60614032 improve debug statements a bit 2019-05-26 12:36:20 +03:00
George Kiagiadakis
940e1e70c0 endpoint: fix clearing the weak ref
g_weak_ref_clear destroys the weak ref, so it will crash
when _finalize() tries to destroy it again
2019-05-25 23:20:54 +03:00
George Kiagiadakis
aa78db35a7 session-manager: add endpoint-added/removed signals 2019-05-25 23:20:33 +03:00
George Kiagiadakis
901593e217 endpoint: improve GVariant format docs 2019-05-25 23:19:28 +03:00
George Kiagiadakis
8e7f84d888 endpoint: add methods to register to the SM and use them in simple-endpoint
This changes the registration point to be the endpoint and not the
session manager, as it seems easier to implement (the implementation
will not need to keep a pointer to the session manager around)
2019-05-24 17:19:58 +03:00
George Kiagiadakis
06db0e414a factory: improve API and hide its implementation (better for introspection) 2019-05-22 13:03:24 +03:00
George Kiagiadakis
1c44476b5e endpoint: add documentation 2019-05-21 18:58:30 +03:00
George Kiagiadakis
5f853d0e53 endpoint: refactor slightly the public API
* Make streams a GVariant array, for future-proofness
* Add API for controls (volume, mute, brightness, contrast, etc...)
* Remove API for profiles (it's not well-thought; may be re-added
  in the future)
2019-05-21 18:27:07 +03:00
George Kiagiadakis
447c968846 Refactor everything!
After discussing things at the AGL May 2019 F2F meeting
and reflecting on the initial design of WirePlumber,
it became clear that it needed a fresh start.
2019-05-17 13:34:07 +03:00