Commit graph

2234 commits

Author SHA1 Message Date
George Kiagiadakis
417b0dff4c m-std-event-source: don't push events during the core dispose sequence 2023-06-23 18:01:26 +03:00
George Kiagiadakis
a982b7917c tests: reduce logs coming from libpipewire
These tests are meant to catch wireplumber issues, so the libpipewire
logs are not very interesting and just make it hard to go through
the interesting bits
2023-06-23 18:01:26 +03:00
Duncan Overbruck
760ce55de1
device/state-routes.lua: fix finding stored routes
This wrongly stored the matched route in a new variable instead of the
locally declared variable it supposed to use.
2023-06-23 13:13:44 +02:00
Duncan Overbruck
7eb6ff3b9e
device/state-routes.lua: fix check for empty selected-routes
This hook and previous hooks hooks default to setting the
selected-routes event property to an empty table, not nil.
2023-06-23 13:13:44 +02:00
Ashok Sidipotu
b0460d8050 src/scripts: add few comments 2023-06-22 16:28:56 +05:30
George Kiagiadakis
a0497b4256 Merge branch '0.4' into next 2023-06-21 20:59:04 +03:00
George Kiagiadakis
2840964f37 internal-comp-loader: fix error ownership in parsing step 2023-06-20 17:20:01 +03:00
George Kiagiadakis
19cfd37da6 comp-loader: register the component & feature only if it activates successfully
Fixes #470
See also !503
2023-06-20 17:20:01 +03:00
George Kiagiadakis
357105fa94 gitlab-ci: bump ubuntu image to 22.04 LTS
Required for more recent glib
2023-06-20 12:39:29 +03:00
George Kiagiadakis
db5bd534ce tests: do not explicitly free f->base.conf_file
This is done inside wp_base_test_fixture_teardown() now, as it should.
2023-06-20 12:39:29 +03:00
George Kiagiadakis
e738076cb0 conf: refactor component loading to use a dependency system
Each component can now list required and optional dependencies,
using the component feature names to match other components.
In addition, each component feature can be declared as required, optional
or disabled, making optional components easier to deal with.
The component flags (ifexists, nofail) have been removed.

Using virtual components, this system also allows easier customization
of which components should be loaded for a specific configuration,
without requiring the user to copy the list of components and edit it.

Also bump the required glib version to 2.68 for g_assert_cmpstrv()
2023-06-20 12:39:29 +03:00
George Kiagiadakis
9c2d25b985 tests: add component loader unit test 2023-06-20 12:39:29 +03:00
George Kiagiadakis
8a8cd97ca8 core: make the object registration functions public
This allows registering arbitrary objects on the core's registry and
finding them later, without having to add API for each and every object.

I think this is useful enough to have it public, even though it's
probably not going to be used that much... The rationale here is to
allow registering custom component loaders without having to make them
subclass WpPlugin or to create custom API for registering component
loaders specifically.

Also, remove the wp_plugin_register() and wp_si_factory_register()
functions, since they are not going to be used much in the future.
The idea is to let the component loader do the registration under the
scenes, as the component is getting loaded.
2023-06-20 12:39:29 +03:00
George Kiagiadakis
c7cb193588 core: introduce the notion of provided features on components
Each component can optionally "provide" a feature, which is basically
a string that describes the feature (ex. "support.dbus"). If the
component loads successfully, the feature is marked as provided and
can be tested for its presence with wp_core_test_feature()
2023-06-20 12:39:29 +03:00
George Kiagiadakis
f878e2f62d properties: add json to properties converters 2023-06-20 12:39:29 +03:00
George Kiagiadakis
add310d9eb dbus: refactor WpDBus into a plugin called dbus-connection
Now that we have proper module load order, we can have this shared
dbus connection in a module instead of the library. The module has
to be loaded before any other modules that need it, obviously.
2023-06-20 12:39:29 +03:00
Julian Bouzas
e24e52c6d3 spa-json: encode the string directly into the builder
Some special characters like '\v' are encoded using 6 characters, which
currently does not work because the VLA size asumes a maximum of 4 characters
per encoded special character. This patch refactors this logic to avoid using
VLAs at all and encodes the string directly into the builder.

See #471
2023-06-19 12:03:23 -04:00
Julian Bouzas
e91a9583d8 spa-json: Fix conditional jump on uninitialised value when adding empty strings to builder
Similar to wp_spa_json_builder_add_property(), we need to make sure the dst
array in wp_spa_json_builder_add_string() has room for the null character
because builder_add() expects it.

Fixes #471
2023-06-19 08:07:02 -04:00
Pauli Virtanen
baa0940d8b bluez: disable auto-connect by default
Disable bluez5.auto-connect.

It makes PW to try connect to all locally known BT audio devices on
start, which is in general not a good thing to do.

Some BT adapters are not capable of simultaneous audio streaming and
scanning for connections (e.g Raspberry Pi builtin BT, probably more),
so audio stutters until adapter/kernel give up trying to connect to
devices that cannot be reached.

Disabling it makes devices to not reconnect on user VT switch, but also
that we should only do for devices that were connected when logind
switched.
2023-06-19 07:27:31 +00:00
Duncan Overbruck
542e56d9f7
conf: fix equal matches 2023-06-17 20:07:58 +02:00
Duncan Overbruck
575030aaf3
tests: add conf test for equal matches 2023-06-17 20:07:11 +02:00
George Kiagiadakis
5d4db78427 suspend-node: check if the node still exists before suspending it
After a timeout, it's possible that something else may have
destroyed the node already. This can happen for example with virtual
sinks that were created from another process.

Fixes: #467
2023-06-14 23:26:30 +03:00
George Kiagiadakis
a7b8966c06 node: prevent crashing if the proxy isn't bound
Related to: #467
2023-06-14 23:00:56 +03:00
David Turner
f112d424ca Remove RestrictNamespaces from systemd service
libcamera uses namespaces to sandbox IPA (Image Processing Algorithm)
modules because they are sometimes proprietary binary blobs.  The
RestrictNamespaces option in Wireplumber's systemd service breaks this
sandboxing when libcamera is loaded via the libcamera SPA module, so
cameras requiring an IPA do not work.

This commit removes RestrictNamespaces so that the sandboxing works
again.  I've confirmed that after this change wireplumber works with
libcamera with an IPA module.

Resolves #466
2023-06-13 15:41:45 +01:00
Julian Bouzas
19213efa9f event-hook: fix different signedness comparison warning 2023-06-05 15:20:44 -04:00
George Kiagiadakis
b347415501 main: move the code that loads the components section into the library
This allows it to be reused in other wireplumber clients and tests
2023-05-29 15:48:39 +03:00
George Kiagiadakis
55fc845098 component-loader: make wp_core_load_component_finish() return a boolean
There is no reason to return the component object... all components
are supposed to be long-lived objects that are referenced by the
registry and there is API to find them. The caller is only interested
in the success or failure of the operation.
2023-05-28 21:07:15 +03:00
George Kiagiadakis
7fdbf7ff50 component-loader: activate & register objects through a common code path
Do this in wp_core_load_component() and let the component loaders worry
only about creating the object.

Also run the main loop in tests while loading components, to ensure
that the async operation finishes before continuing execution. GTask
makes sure to make the operation async always, by emitting the callback
from an idle GSource.
2023-05-26 21:22:48 +03:00
George Kiagiadakis
d0e96358ea component-loader: add a load_finish() vfunc to finish the async operation
It's not acceptable to assume that the underlying implementation uses a GTask,
so we have to defer the finish function to the implementation as well
2023-05-26 19:21:51 +03:00
George Kiagiadakis
41c9de30bf core: move wp_core_load_component* declarations to component-loader.h 2023-05-26 18:59:42 +03:00
George Kiagiadakis
f53185e951 component-loader: move module loading to a new WpInternalCompLoader object 2023-05-26 13:49:40 +03:00
George Kiagiadakis
843e7ef4dd component-loader: pass core and cancellable parameters in load()
Regarding the core parameter, the case used to be that WpComponentLoader
was a WpPlugin, so it had a reference to the core internally, but since
this is no longer a requirement, we need to pass this explicitly
2023-05-26 13:04:10 +03:00
George Kiagiadakis
eb180cebe8 component-loader: convert WpComponentLoader to a GInterface 2023-05-25 19:20:40 +03:00
George Kiagiadakis
5c3032c064 core: change the component arguments to be WpSpaJson instead of GVariant
This allows us to pass entire JSON objects from the config file
down to the modules / scripts without any conversion
2023-05-25 18:29:58 +03:00
George Kiagiadakis
d755ec4f20 log: ensure that warnings from pw/spa are printed as warnings
converting a spa log level to a native log level is not trivial, it seems;
when we want to print a message, we should map 2 (WARN) to W, but when we
want to translate WIREPLUMBER_DEBUG=2 to a log level, we should map 2 to N
2023-05-25 18:25:41 +03:00
George Kiagiadakis
70980fe355 lua: json: catch syntax errors when converting to native lua types
and most importantly, push nil on the stack, so that there is something
returned from this function... the caller always expects a value to
be pushed
2023-05-25 18:22:26 +03:00
George Kiagiadakis
8912dc25c3 log: fix log level mask to be able to test the trace level
Trace is 1<<8 and the mask was 0xFF, allowing only bits 0-7
to be tested
2023-05-25 17:59:56 +03:00
George Kiagiadakis
bd672b71f7 script-tester: decouple script tests setup/teardown from basic
basic_tests_setup points to a config file that doesn't exist in
the script tests directory
2023-05-24 19:45:58 +03:00
George Kiagiadakis
6dc5ac089a wpctl: add status options to display device/node names and nicknames 2023-05-23 11:41:38 +03:00
George Kiagiadakis
49ea4d90f6 tests: run with WIREPLUMBER_DEBUG=T, not 7... 2023-05-19 21:13:19 +03:00
George Kiagiadakis
5ce80a0528 meson: bump version to 0.4.80 and API version to 0.5 2023-05-19 20:20:35 +03:00
George Kiagiadakis
982bebe5aa scripts: use log topics 2023-05-19 20:12:08 +03:00
George Kiagiadakis
9e09f4e221 docs: update the log system documentation 2023-05-19 19:46:17 +03:00
George Kiagiadakis
ae7bed5655 log: make the level name a plain character in the log_level_info struct 2023-05-19 11:04:56 +03:00
George Kiagiadakis
cbf0d7284a log: make debug level 0 enable fatal errors
We always want to show fatal errors
2023-05-19 10:58:31 +03:00
George Kiagiadakis
3034fc7c79 log: accept 0 as a level and do safety checks on the level string 2023-05-19 10:50:46 +03:00
George Kiagiadakis
4f27d18bd3 log: rename "message" level to "notice" and print criticals with "E"
Syslog calls this level "notice" and I prefer it because we use it
to display significant messages that are not warnings, but they
are not really "standard", as GLib wants them to be. There is nothing
"standard" about log messages in general.

Also, make these notice messages be enabled at debug level 2, together
with warnings. The default log.level is 2 and it is a good idea to show
notices by default too.

Finally, show them in the log with "N" and also change criticals to be
shown with "E", meaning "error"... Then promote G_LOG_LEVEL_ERROR
messages to be shown with "F", meaning "fatal", because in fact these
messages are always fatal and always call abort(). Still, keep the term
"critical" in the functions to make sure that whoever uses them is aware
that this level is only for critical conditions and not suitable to
display any kind of error.
2023-05-18 16:19:49 +03:00
George Kiagiadakis
89c31d8190 log: disable "conn.*" topic by default, like pipewire does
This topic contains traces to debug the pipewire socket protocol.
Adding this pattern allows WIREPLUMBER_DEBUG=5 to show everything
except this trace by default, which is a more reasonable amount
of trace. To enable it, it must be explicitly specified in the
WIREPLUMBER_DEBUG env variable.
2023-05-18 15:53:50 +03:00
George Kiagiadakis
17b893c266 log: always set PIPEWIRE_DEBUG 2023-05-18 13:10:13 +03:00
George Kiagiadakis
b7e4654da4 log: rename log_level_index to level_index_from_flags, for consistency 2023-05-18 13:04:33 +03:00