Return the result from sm_media_session_create_links() as the
result of link_nodes. This is > 0 when something was linked, < 0
on error and 0 when no ports are available. We should be able to
use this result later to handle errors.
We first need to issue the start command for driver nodes and then
we can add the node to be scheduled. Else we might end up with nodes
that receive the _process callback without the Start command being
called first and we can crash.
See #904
When a node does not have routes, treat it like a stream and use
the restore-stream logic to restore the volumes.
Rework some of the logic a little. Don't save empty strings. Wait
for param updates to save/restore values.
This makes volume restore work on virtual sinks/sources and
sinks/sources without any routes.
See #729
When we start draining, set ourselves active so that the process
function is called where the draining is completed.
This avoids a corked stream from waiting forever to drain the stream.
Fixes#946
If buffer type char[] is 4-byte aligned, higher 3-byte on char could be non-zero if data is not initialized, which make 'buffer[i] >> 4' larger than 0x0f.
Use type uint8_t[] on SEC_LABEL buffer to fix it.
libpulse assumes in introspect.c:fill_card_port_info that port profile
array size <= card profile array size, and may crash otherwise.
Enforce this in fill_card_info. It can happen, if EnumRoute and
EnumProfile info is not in sync.
When a new node is configured, check if existing streams might need to
be moved to it.
This fixes the case where a stream has a target node set to some
bluetooth device and it starts playing to the default device because
the bluetooth device is not connected. When the BT device is then
connected and configured, the stream is moved to the new BT device.
errno should be set to the positive errno value.
This does not cause problems except for the pulse-server where the
errno value is negated and returned as an error result.
A sink can be set as a default source, which means that the default
source is the monitor ports of the sink.
Move the direction check for later so that we can first check if we
are dealing with a potential default sink/source for the given
direction. If we found a default sink/source, we don't need to do
the direction check anymore.
This makes it possible to set a sink as a configured default source
and have policy-node take this into account when defining the
default.source metadata.
See #715, #908
Add new context config clock.power-of-two-quantum to make it possible to
not round quantum to closest lower power of two. This makes it possible
to match the quantum of a source node with the quantum of a client
node.
Allows monitors (eg. bluez5) free any sm_objects they hold in
session_destroy. In session_shutdown, destroy such objects before the
event, and free them only afterward.
Fixes double-free in bluez monitor.
WE can only delay the start for drivers that are driving. Remote
nodes are driving themselves but are not drivers so they need to
start early.
See #879
A node starts out as passive but becomes non-passive when there
is a non-passive link to an active node. If there is a link to
an inactive node, the node remains passive.
This fixes suspend of drivers in all cases.
Fixes#898
Don't always try to restore the saved profile when it's available
but only do this the first time. From then on, try to follow the
best profile when it changes.
If a driver node is linked with a non-passive link to itself, it
should also become running.
One example of this is the Midi bridge, that needs to start when you
link one device to another. The devices are all on the same node
so linking devices would result in loopback connections.
libcamera + bluez5 devices should be freed/unloaded via the sm_object
free callback, similarly as in alsa and v4l2 monitors. This ensures
they are run at session_shutdown.