This simplifies the code and also avoids a warning with _FORTIFY_SOURCE:
../pipewire/src/modules/module-protocol-pulse/pulse-server.c: In function ‘create_pid_file’:
../pipewire/src/modules/module-protocol-pulse/pulse-server.c:6028:2: warning: ignoring return value of ‘write’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
6028 | write(fd, pid_str, strlen(pid_str) + 1);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Make arrays from config sections that should really be an array.
Having the module name as the object key technically makes it
impossible to load the same module twice because the key can only
be once in the object.
The same applies to the context.objects and context.exec sections.
This also makes it somewhat easier to parse the config..
Because we set the default sink/source before calling the metadata,
we don't send out updates about the new sink and this confuses
pavucontrol.
Instead, use the new async reply to reply once the new metadata has
been configured and the defaults have been updated.
We only want to restore the saved profile when it is available, when
it is not available and there was no change in best profile, leave
the profile as it is.
Keep track of the best profile. Only try to switch away from the
saved profile when something changed and the saved profile is not
available.
This makes it possible to select an unavailable profile but when
something is changed, it will switch away from it.
A node.target property of -1 also means to follow the default
sink/source. The ALSA plugin might use this to select the
target node and would otherwise not move to the new default sink.
Only start the driver node after we have added ourselves to the
driver node or else we might start too soon, before there is anything
to schedule and we cause driver underruns.
Only activate the links when the node is added to a driver. Otherwise
the driver will expect us to decrement the activation counters for the
links but that won't happen because the node will not be processed
yet.
Instead we activate the links that were not activated yet when the
node is activated.
This improves scheduling for newly added links and nodes.
When we were busy with the graph recalculation and something changed,
restart the graph state change to get the new change applied.
For example, when we start a node and it has a max-quantum set, we
need to restart our calculation with the new quantum limits.
Use the manager sync method to wait until all pending queries are
finished. It is the manager that will query the new parameters so
we need to wait until that completes.
See #868
Trigger a roundtrip before we send the reply to the client for many
methods like set_volume/set_mute etc.
this ensure that we get the updated information from the server before
we reply so that a subsequent query returns the up-to-data information.
Fixes#868
Every time a new operation is started, schedule a rescan. This
ensures that there are no more pending actions before the policy
module scans the nodes.
This has the effect that all devices and nodes are up to data and
ready to be used by policy-node.
Fixes#789
Move the profile switching from default-route to the default-profile
module. This makes more sense and it also allows us to restore the
saved profile when it becomes available.
Make default-profile always check if the saved profile can be restored
before attempting to switch to the best profile.
Default-route now just monitors profile changes and restores the
routes associated with it.
See #466
If the default sink or source is set as the target, just don't save
the new target so that it follows the new default.
This is a workaround for gnome-control-center first setting the
default source/sink and then setting the targets on all
stream-restore database entries to the new default. Setting an
explicit target will pin the stream to that sink/source forever,
which is then making pavucontrol default source/sink toggle
fail.
See #676
In COMMAND_SET_DEFAULT_SINK/SOURCE, set our default source and sink
immediately instead of waiting for the metadata update. This makes
it possible to check for the new default sink immediately in other
modules.
Don't just store the id in the metadata but a JSON object with
the node name. This makes it possible to easily introspect the
metadata and also extend the metadata with more fields later.
Instead of matching the metadata id to the global ids we now
have to match it against the name.
The session manager might be configured without metadata support
so check this before attempting to use the metadata. It's not
really a problem because the default sink/source can only be
changed with the pulseaudio API, which activates metadata.
The prefix was used to filter the properties when loading and
saving but since the conversion to the core provided functions, this
feature is not longer available.
It's not exactly a problem, we could implement the filtering ourselves
afterwards but there is little point because we just ignore the unknown
items and never write invalid items.
The branch should be taken if errno is neither EAGAIN,
nor EWOULDBLOCK.
Previously,
if (errno != EAGAIN || errno != EWOULDBLOCK)
would be taken for all values of errno if EAGAIN != EWOULDBLOCK.
(Except for the ones that are filtered out before.)
Fix that by changing `||` to `&&`.
node.latency also influences the pipeline latency in that it can
push the latency above the default value.
node.max-latency, instead, is only used to clamp the final latency
of the pipeline.
Make a registry of modules
Assign an unique number to each module with the MODULE_FLAG bit set
so that we can also enumerate them
Implement enumerating our internally loaded modules
Implement unloading of the module using the module id
Move module-null-sink into a separate file
Use Audio/Sink if no other media.class was given, so that it works
just like the pulseaudio module
Enable linger=true in all cases.