Commit graph

998 commits

Author SHA1 Message Date
Dmitry Sharshakov
11b3803edc policy-dsp: add a policy for loading filter chains
Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com>
2023-09-25 12:31:18 +03:00
Julian Bouzas
06fa06ca5c scripts: fix minor issues with smart filters policy
The filter's destination target was not being found properly due to iterating
the matching rules table with ipairs instead of pairs... the later is meant to
be used with JSON objects. In addition, the filters were not being re-evaluated
and linked properly when a device node was removed, this is because of a typo in
the find-best-target.lua script.

See #501
2023-09-21 09:04:31 -04:00
Jonas Holmberg
92e53bb7ba policy-device-profile: Use device.profile if set
Don't set best profile if device.profile property has been set with
alsa_monitor.rules.
2023-09-15 17:56:29 +02:00
George Kiagiadakis
ca58c68ef9 config: alsa: increase VM period-size to 1024
Fixes: #507
2023-09-13 16:02:55 +03:00
Julian Bouzas
56017fdbe6 scripts: use filter-utils to implement smart filter policy 2023-09-03 14:33:34 +00:00
Julian Bouzas
1ba3844f2c scripts: add filter-utils.lua
Utilities Lua script for the policy to easily handle filter nodes.
2023-09-03 14:33:34 +00:00
Julian Bouzas
b984af7c87 scripts: add filters_metadata.lua
Creates a filters metadata to configure filters at runtime.
2023-09-03 14:33:34 +00:00
Julian Bouzas
d383762812 device: remove echo-cancel configuration
This will be possible to do with the new filter-utils.lua design.
2023-09-03 14:33:34 +00:00
George Kiagiadakis
67f9f63520 Merge branch '0.4' into next 2023-09-01 19:12:20 +03:00
George Kiagiadakis
02e1393c9f policy-node: destroy node only after sending an error to the client
if the node is destroyed before, pw_stream shuts down and doesn't
relay the error to the application
2023-09-01 16:23:09 +03:00
Julian Bouzas
dcee74fcca scripts: do not store the link in si_flags
Otherwise the link is not destroyed right away when doing silink:remove()
2023-08-15 16:32:19 -04:00
Ashok Sidipotu
591d0b4370 camera-monitors: add a config property for camera discovery timeout 2023-08-15 07:14:59 +00:00
Ashok Sidipotu
2d4cdcd5da wireplumber.conf: run monitors towards the end
This solves the problem of linkables not created for libcamera nodes. It makes
sense to run monitors towards the end when rest of the system is really
waiting for them.
2023-08-15 07:14:59 +00:00
Ashok Sidipotu
359ea7b17d monitor-utils: use uniform naming style for lib apis 2023-08-15 07:14:59 +00:00
Ashok Sidipotu
426e1bbffe camera monitors: introduce cam device arbitration logic 2023-08-15 07:14:59 +00:00
Ashok Sidipotu
7bca8cacde camera monitors: pass device and node properties as event data
This avoids event properties show up in device and node properties.
2023-08-15 07:14:59 +00:00
Ashok Sidipotu
92de80eb2e wireplumber.conf: add new v4l2 monitor hooks 2023-08-15 07:14:59 +00:00
Ashok Sidipotu
f45d7b43f3 v4l2/monitors: rebase v4l2 monitor into a bunch of hooks 2023-08-15 07:14:59 +00:00
Ashok Sidipotu
86ea1f61f9 wireplumber.conf: add the new libcamera monitor hooks 2023-08-15 07:14:59 +00:00
Ashok Sidipotu
bb0e15e631 libcamera/monitors: rebase libcamera monitor into a bunch of hooks 2023-08-15 07:14:59 +00:00
Ashok Sidipotu
6596d71c4f monitor-utils: introduce monitor utils lua library 2023-08-15 07:14:59 +00:00
Stefan Ursella
407c2f04de scripts: run find-best-profile hook before running apply-profile hook 2023-07-17 17:33:40 +02:00
George Kiagiadakis
84d3382292 config: make it possible to have feature profiles
A profile is a list of features set to required/optional/disabled
which governs which components are getting loaded, given a static
components list with well-defined dependencies
2023-06-23 20:15:26 +03:00
George Kiagiadakis
840a2304b4 core: load components internally and refactor main to just activate it
+ move the export-core creation and media-session check to be built-in components
+ add WpCore API to find the export core
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
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
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
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
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
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
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
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
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
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
6dc5ac089a wpctl: add status options to display device/node names and nicknames 2023-05-23 11:41:38 +03:00
George Kiagiadakis
982bebe5aa scripts: use log topics 2023-05-19 20:12:08 +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
4736d56557 log: implement a log topics system, like pipewire
The intention is to make checks for enabled log topics faster.

Every topic has its own structure that is statically defined in the file
where the logs are printed from. The structure is initialized transparently
when it is first used and it contains all the log level flags for the levels
that this topic should print messages. It is then checked on the wp_log()
macro before printing the message.

Topics from SPA/PipeWire are also handled natively, so messages are printed
directly without checking if the topic is enabled, since the PipeWire and SPA
macros do the checking themselves.

Messages coming from GLib are checked inside the handler.

An internal WpLogFields object is used to manage the state of each log
message, populating all the fields appropriately from the place they
are coming from (wp_log, spa_log, glib log), formatting the message and
then printing it. For printing to the journald, we still use the glib
message handler, converting all the needed fields to GLogField on demand.
That message handler does not do any checks for the topic or the level, so
we can just call it to send the message.
2023-05-16 20:42:28 +03:00
Pauli Virtanen
5a00686e3c bluez: minor configuration fixup
api.bluez5.connection-info is not a setting, but must always be enabled.
The bluez-midi servers should also not be enabled by default.
2023-04-17 19:41:28 +03:00
George Kiagiadakis
33fcccf44a daemon: homogenize the init transition debug messages 2023-04-17 07:48:18 -04:00
George Kiagiadakis
049992866c daemon: use g_steal_pointer() to NULL-ify the head of the components list 2023-04-17 07:48:18 -04:00
George Kiagiadakis
7ed188fba3 daemon: use a different GList pointer to iterate the components list
This keeps the original head pointer intact, so that we can effectively
free the list later. If we use the head pointer to iterate, then at the
end we are not freeing anything because the pointer is NULL
2023-04-17 07:48:18 -04:00
George Kiagiadakis
8505e75cd0 daemon: wait for export-core to be connected to continue the transition 2023-04-17 07:48:18 -04:00
George Kiagiadakis
f00011d23a daemon: fallthrough to the error case instead of repeating cleanup statements 2023-04-17 07:48:18 -04:00
George Kiagiadakis
13f9f98bc8 daemon: check for media-session before loading any components
We shouldn't start doing anything if another session manager is running,
it will just break the other session manager's state.
2023-04-17 07:48:18 -04:00
George Kiagiadakis
51d5beb36c daemon: remove redundant calls to component_data_free()
The component data pointer in this function is wrapped in g_autoptr,
so this should happen automatically
2023-04-17 07:48:18 -04:00