Commit graph

545 commits

Author SHA1 Message Date
Julian Bouzas
0c51cf9a7b session-item: fix reference leak when getting properties 2021-07-02 11:59:42 -04:00
Julian Bouzas
2900dc1c23 object-manager: remove old global when exposing new global with same id
Sometimes, especially when running the wireplumber daemon with valgrind, a new
global with the same Id as another old global owned by a proxy wants to be
exposed before the old proxy is destroyed. If this happens, instead of returning
with an assertion error, we remove the old global and we export the new one.
2021-07-01 14:49:28 -04:00
Julian Bouzas
4275d91675 global-proxy: add extra checks to make sure binding is successful
Globals can be removed by the object manager when their associated proxy is
currently being bound. Adding extra checks in wp_global_proxy_bin() to return
a transition error avoids binding the proxy when that happens.
2021-07-01 14:37:42 -04:00
George Kiagiadakis
888d6e5033 lua: add Port.get_direction() + documentation for it 2021-06-30 19:51:21 +03:00
George Kiagiadakis
7fedb5e9e1 wplua: expose functions to convert enums to strings for lua and vice versa 2021-06-30 19:51:21 +03:00
Julian Bouzas
ee190411f4 state: escape invalid key file characters 2021-06-30 08:48:57 -04:00
Julian Bouzas
6b8ea83404 wpipc: sender: disconnect and clear all pending tasks if connection was lost
If we don't remove the socket from epoll when the connection is lost, we risk
having the lost callback triggered more than once by epoll, creating race
condition in the unit test because more than 1 event happened. The epoll thread
and socket will be re-created again when re-connecting.

Note that we cannot destroy the epoll thread before triggering the lost
connection callback because we are running the callback in the epoll thread,
which is why removing the socket from epoll is the only way to make sure the
lost connection callback is only triggered once.
2021-06-28 11:38:37 -04:00
Julian Bouzas
313f872570 wpipc: receiver: also emit sender disconnected when failed to read 2021-06-28 11:38:37 -04:00
Julian Bouzas
f4a4f8bcc7 wpipc: protocol: make sure buffer is initialized to 0 before building reply/request
Fixes valgrind errors
2021-06-28 11:38:37 -04:00
Julian Bouzas
8a5a8fc015 wpipc: change epoll thread func type name to be more consistent 2021-06-28 11:38:37 -04:00
George Kiagiadakis
c41d042dd0 wplua: remove handling of LUA_ERRGCMM, which is removed in lua 5.4 2021-06-27 07:57:06 +00:00
Julian Bouzas
5b4b360b1c wp: log warning if PIPEWIRE_DEBUG env variable could not be set 2021-06-25 08:50:08 -04:00
Julian Bouzas
892b0dada6 lib: Use #define instead of 'static const' for constants
Fixes build errors when using GCC older than v8.1
2021-06-24 09:24:16 -04:00
George Kiagiadakis
1075d23fab lib: fix some issues found by coverity 2021-06-15 17:43:22 +03:00
George Kiagiadakis
801ac7aa1a wplua: add a wplua_checkclosure() helper function 2021-06-10 14:53:08 +03:00
George Kiagiadakis
7355215cf1 pipewire-object: change params-changed signal to take a string param name
To be consistent with the rest of the API where strings are used
to identify param types
2021-06-09 13:29:34 +03:00
George Kiagiadakis
f9767d19a6 lib: add struct paddings to be able to maintain ABI compatibility
Aim for 8 pointers on each struct, wich exceptions:
- 12 pointers for already crowded/important ones
- 4 pointers for empty ones that are used for proxies; we are
  unlikely to add any virtual methods on these classes ever
2021-06-08 17:38:14 +03:00
Julian Bouzas
83e50396ee pw-object-mixin: ignore set param on already destroyed objects 2021-06-08 09:08:13 -04:00
Julian Bouzas
21e73141c6 proxy: destroy pw_proxy if bind_error is called 2021-06-08 09:08:13 -04:00
Julian Bouzas
7d28027f9b wplua: fix memleak when converting GVariant to Lua 2021-06-07 11:33:21 -04:00
Julian Bouzas
fc8cc09654 global-proxy: fix leak when getting global properties 2021-06-07 11:33:21 -04:00
Julian Bouzas
a12c41aca1 spa-pod: check if pod is valid before _parser_can_collect
Spotted with clang-tidy, avoids possible segfault if pod is NULL.
2021-06-07 11:33:21 -04:00
George Kiagiadakis
ac5c2ebbba object-interest: remove unused _copy() method
object-interest is now ref-counted, so we can use _ref()
2021-06-07 17:56:32 +03:00
George Kiagiadakis
450deabb40 object-manager: small doc fix 2021-06-07 17:47:42 +03:00
George Kiagiadakis
1ca67abc66 object-manager: support declaring interest on all properties of globals
Until now, object manager could only match pw global properties on
pw global objects, because this is the only available properties set
at the time the registry creates the global.

With this change, the object manager will now bind the proxy
if the type and the pw global properties have matched and will wait
until the proxy is available with all of its properties and tries
the check again.
2021-06-07 17:47:42 +03:00
George Kiagiadakis
997bdb65cd object-interest: enrich _matches_full() to be able to check all constraints 2021-06-07 17:47:42 +03:00
George Kiagiadakis
38f7483793 state: remove support for groups and propagate save errors
There is no real use for groups in our API. Just use the name of
the file as the default group and be done with it...
Storing multiple groups with this API is problematic because it
forces flushing the file to disk multiple times, one for each group,
and it's just more performant if we use a prefix in the keys
to implement some form of logical separation.

This commit also makes the GKeyFile a temporary object. As we
always load the file from the file system in _load()
and we always replace its contents with a new dictionary in _save(),
there is no point in keeping the keyfile's internal data structures
stored in memory.

Save errors are now also propagated to adhere to the programming
practices of GObject
2021-06-04 18:36:19 +03:00
George Kiagiadakis
4948f6f2f6 state: don't stat() before creating the dir or removing the state file
there is no point
2021-06-04 18:36:19 +03:00
Julian Bouzas
cde38daabf pipewire-object: fix memory leaks when getting properties 2021-06-03 14:53:00 -04:00
Julian Bouzas
214c7a444a endpoint: free media_class when disposing WpImplEndpoint 2021-06-03 14:53:00 -04:00
Julian Bouzas
3fbcf05c9b pipewire-object: take ownership of param argument
The wp_pipewire_object_set_param API must take ownership of the param argument
as described by the documentation.
2021-06-03 14:53:00 -04:00
Julian Bouzas
d28f1241cc object: advance pending transitions if activation fails 2021-06-03 09:38:19 -04:00
Jason Francis
1b5df6096a docs: include wp.h in gir sources 2021-06-02 17:38:34 +00:00
Jason Francis
ed8346e77d docs: Add brief descriptions to all functions
This ensures all of these functions are picked up by g-ir-scanner.
2021-06-02 17:38:34 +00:00
Julian Bouzas
4a1ee67303 global-proxy: make sure registry is valid before requesting destroy
Avoids segfault when requesting destroy if core is disconnected
2021-06-02 16:42:15 +00:00
George Kiagiadakis
9db0e741cd lua: allow the Log api to debug boxed objects (useful for pods) 2021-06-02 19:38:51 +03:00
Julian Bouzas
8698d4f43a object: use weakref when advancing current transition
Fixes reference count leak when activating an object and transition fails
2021-06-01 13:46:52 -04:00
Julian Bouzas
efb0f83d1f object: use destroy notify to keep self alive while advancing transitions 2021-06-01 13:43:25 -04:00
George Kiagiadakis
c3ee52506b docs: fix gobject-introspection data generation
Let g-ir-scanner parse the original headers for the C signatures
and just add the gtk-doc comments in the generated wp-gtkdoc.h file

Also cleanup a bit gen-api-gtkdoc.py and make it omit printing most of the
whitespace clutter that it used to print inside the gtk-doc comments
2021-05-25 14:19:53 +03:00
George Kiagiadakis
b812e912d2 docs: fix C API documentation to work nicely with doxygen & sphinx 2021-05-25 14:19:53 +03:00
George Kiagiadakis
93c2e7d686 meson: refactor docs + gi build system
* Use custom_target() instead of configured shell scripts
* Do not copy all the .rst files in the build directory
* Setup dependencies between targets
* Tidy up dependencies lookup
* Remove unused files
* Upgrade Doxyfile to the latest version and cleanup used options
2021-05-25 14:19:53 +03:00
Raghavendra
2e5b13f970 docs: build gobject introspection from xml files generated by Doxygen 2021-05-25 14:19:53 +03:00
Raghavendra
d692f06f0d docs: api: Replace hotdoc specific commands with Doxygen specific commands 2021-05-25 14:19:53 +03:00
Julian Bouzas
3e6edcb02e pipewire-object-mixin: fix memleak in GList 2021-05-24 12:59:11 -04:00
George Kiagiadakis
4e3ca5dc15 wplua: ref closure before invalidating it
invalidation may destroy the closure and this will trigger
_wplua_closure_finalize(), which will remove the closure from the
array while the original code is also trying to do the same

if we destroy the closure after it has been removed from the
array, _wplua_closure_finalize() will not remove anything and
will continue happily
2021-05-22 10:52:35 +03:00
George Kiagiadakis
f0d33cb873 endpoint: remove wp_endpoint_create_link()
Not used and not useful with the current design.
May be reverted in the future, if necessary.
2021-05-21 19:57:31 +03: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
188a10e0e7 pipewire-object-mixin: make sure enum params task is only triggered once
Always remove the task from the list before returning to make sure it will
always be triggered once.
2021-05-19 10:26:17 -04:00
Julian Bouzas
7e23f313b3 proxy: don't accept NULL pw_proxy in set_pw_proxy API 2021-05-18 10:01:13 -04:00
Julian Bouzas
8fdd99d956 global-proxy: delay object creation until bound feature is requested
Allows handling errors if creation fails
2021-05-18 09:24:33 -04:00