Move closure annotations from data parameters to function parameters and
also add destroy annotations where necessary. This fixes the "invalid
closure annotation" warnings during the build.
`wp_settings_new_iterator()` takes a reference to the underlying
`WpSettings` object with `g_object_ref()`, however, it fails to
release it during finalization. Fix that.
Some modules (like module-loopback) may destroy themselves with
pw_impl_module_schedule_destroy() when the pipewire connection closes.
In that case, we need to clear our pointer so that we don't try to
destroy them again (and crash)
Fixes: #812
This patch caches the settings info to make sure their values are always
updated, even if using the settings API multiple times before pipewire
finishes synchronizing the metadata objects.
Fixes#749
Systemd journal entries have several common entries:
https://www.freedesktop.org/software/systemd/man/latest/systemd.journal-fields.html
Add "SYSLOG_IDENTIFIER" to make it easier to find wireplumber messages.
Add "SYSLOG_FACILITY" to avoid confusing programs that expect both or neither.
Add "TID" and "SYSLOG_PID" to make debugging a little easier.
It is valid for components not to have a "provides" field, but it
prevents them from being able to have "before" and "after" dependencies.
With this patch, we generate a hidden "provides" field so that the
dependencies sorting algorithm can work without issues.
Fixes: #771
Fix memory leaks in bad GValue handling. Unset iterator GValue after
use and strdup keys. The keys aren't necessarily static strings (for
id-XXXX properties), so have to be dup'd.
Allow marking WpSpaDevice object ids "pending", which means Props from
any ObjectConfig events received for the ids are saved, if there is no
associated object set yet.
When wp_spa_device_store_managed_object() is called, any pending Props
are set on the managed object.
This is useful when nodes cannot be immediately created in the
"create-object" signal handler. For example, in cases where the nodes
are created asynchronously, e.g. by "module-loopback". In this case,
although the nodes can be later associated with the WpSpaDevice, any
ObjectConfig events received in the meantime are lost, so for example
restoring saved Routes will race against async node creation. Using
wp_spa_device_set_managed_pending() solves this race condition.
Revamp the profiles section, making use of the inherits feature
and add commonly used profiles for systemwide & embedded use cases,
as well as profiles for a split-instance configuration where the
policy hooks run in a separate instance from the alsa, bluetooth
and camera monitors (which run in 3 separate instances respectively)
Also add an example on how to configure the loaded profile using
a config file instead of the CLI switch.
Fixes: #608
This allows to inherit all the profile definitions of another profile
before the current profile's definitions are parsed, allowing for
more complex structures to be present in the default wireplumber.conf
without too much copy-paste
In some cases, requires/wants dependencies are not enough. As we saw in
!617, the m-standard-event-source module needs to be loaded after all
the hooks, otherwise there may be missed events that the hook was
supposed to "catch", but they were delivered before the hook was actually
loaded. In a similar fashion, we have in purpose put all the "monitor"
components at the every end of the array because if we load them earlier,
they will create devices and nodes before all the hooks are in place to
react.
While in standard configuration we can work this around, in extended
user configurations with custom components, it is impossible to do this
without overriding the entire components array.
To fix this properly, introduce before/after dependencies. They work in
a similar fashion as they work with event hooks. They do not implicitly
"pull" any components to be loaded, but they affect the ordering if the
mentioned components are indeed present.
Note that for backwards compatibility reasons and unlike systemd units,
the "requires"/"wants" targets imply an "after" dependency on them.
Fixes: #600
This allows changing the metadata name in the configuration file
and get all the Lua scripts looking at this new settings metadata
without requiring any other code changes. It can be useful in
multi-instance setups where we'd like the instances to be isolated
and load their own settings instead of relying on each other for that.
This reverts commit 8012fbd5cf.
There seems to be some underlying bug that sometimes causes a crash
when the Bluetooth monitor uses a loopback for autoswitching between
profiles. Reverting temporarily until the cause is fully determined.
See #682
With this change, it is possible to have a top-level object that does
not start at exactly the beginning of the file, allowing comments and
whitespace to exist.
Also add an empty conf file in the tests to verify that
it does not crash.
A bit of refactoring was needed in order to avoid breaking as-section
loading, which expects the entire file to be an object or array and doesn't
parse it.
Fixes: #633
In some cases the monitors emit the object_info callback with the same id
and non-NULL info multiple times. For example, when an ACP profile changes from
output:analog-stereo+input:analog-stereo to just output:analog-stereo, it emits
object_info() with NULL info for the input node and object_info() with updated
properties and the same id as before for the output node.
This causes the spa-device here to emit create-object multiple times for the
same object and this breaks the name deduplication logic. To solve this, make
sure we emit object-removed before calling create-object a second time.
Fixes#500
At the moment, the same transition can be completed multiple times
(assuming sufficiently high reference count):
return_error()
finish()
return_error()
The consequence of that is that the transition closure will be
invoked multiple times. This is unexpected.
Add some guards against completing a transition or calling finish()
multiple times.
Fixes#628
Make decision on whether to show code location in journal messages based
on whether the WpLogTopic would enable DEBUG level messages.
Add wp_logt_checked API to take WpLogTopic as input to make this
possible, and deprecate wp_log_checked.
Logging messages are usually developed based on the stderr logging,
which shows code location and log topics as context, and especially
higher log level messages can be cryptic or useless without that
context.
This context is not shown in journalctl by default, and so usually is
missing from logs submitted by users. In principle it is available in
journalctl but requires extra work to show it.
Fix by prepending the log topic to the messages, like Pipewire logging
does. Also show code locations if log level is high enough.
Currently nothing removes the WpLoopSource from the main context, and we
moreover are creating and attaching unused WpLoopSources when sharing
same pw_context between multiple WpCore.
Fix this by keeping track of the WpLoopSource in the pw_context user
data, only creating them when needed, and finalizing it after the
context is destroyed.
It is intended that the Pipewire loops are "entered" the whole time they
are running, i.e. are going to process further events. Currently we
enter/leave for single iterations, which is not right.
Fix by entering the loop on initial GSource idle callback, and leaving
at finalize.
That the loop has to be left from the same thread it was entered from is
a bit hard to do with GSources, as the finalize callback appears not
guaranteed to be called from any particular thread. I didn't find a
fully general way to do this, so this puts additional constraints on how
WpLoopSource (and WpCore) are to be cleaned up.
If we use the project version as library version,
it is not possible to append something to the
project version to indicate a modified wireplumber version.
A "plain" JSON object may be passed to WpConf constructors. Previously, this
would cause an error as open_and_load_sections expects the first parsed token
to be a string. Use WpProperties to denote that the file being parsed is an
object/container, and specify a section name for it.
Signed-off-by: James Calligeros <jcalligeros99@gmail.com>
Use WpProperties to indicate that searching for and loading
conf.d fragments can/should be skipped.
Signed-off-by: James Calligeros <jcalligeros99@gmail.com>
WpProperties may be used to control the behaviour of a WpConf
object. This allows those properties to be referenced at any time
during the lifetime of a WpConf.
Signed-off-by: James Calligeros <jcalligeros99@gmail.com>
The signature of the function is quite misleading. If an absolute
path is passed to it, it will ignore the directory constraint flags
and search outside of the specified directories anyway. Make a note
of this in its caller.
Signed-off-by: James Calligeros <jcalligeros99@gmail.com>