- pipewire supports parsing unquoted strings and they are used
extensively in JSON .conf files.
- Extend this support into wireplumber, as it wants to use the pipewire
like syntax in its JSON .conf files.
Some devices (Mostly USB devices) have a generic pcm name (USB Audio)
that is quite useless. Filter this out and fall back to the device nick
in that case.
Since nodes may have a target specified in their props, the logic in
cleanupTargetNodeMetadata does not work correctly.
Instead, emulate what Pulseaudio does: if we see a reconnectable node
with target defined by node props, but not by metadata, which is linked
to the default sink, then make the stream follow the default from that
point on.
Setting node target by id is not safe due to id reuse, and so
target.object which specifies the target by its object.serial was
introduced, and is used e.g. by pipewire-pulse.
Use target.object specifications in policy-node if they are present.
wp_transition_get_completed incorrectly returns TRUE for transitions
that have not been advanced at least once, and hence are obviously not
completed. This is because transitions start at STEP_NONE, and
completed transition is also indicated by STEP_NONE.
Fix this by adding a private flag to track whether transition was
started.
Fixes object managers sometimes missing object-changed events. How that
happens is the following:
- object activation transitions are advanced in idle callback
- they are aborted on registry global removal events
- registry global removal event can arrive before the idle callback
- wp_object_abort_activation uses wp_transition_get_completed to
determine whether transition was completed, but it returned bogus
values on transitions that hadn't been started.
This avoids using device.nick, which is the card name, on all nodes
of a card. Useful on UCM, where analog, hdmi, etc are all exposed
as nodes on a single profile.
Some nodes can omit the format/rate/channels to indicate that they can
deal with all possibilities and adapt to what they are linked to.
See pipewire#876
Connecting dont-reconnect nodes that have a defined target to fallback
probably does not make sense.
They will be linked to a target that the client likely did not intend,
and the link will not be changed later on.
In Pulseaudio, if the defined target is not found, streams are not
connected to the fallback but instead fail. This happens also with
streams that don't have DONT_MOVE specified.
Pipewire-media-session also did not link dont-reconnect streams with a
defined target to the fallbacks.
Dont-reconnect streams should not be moved to a new target, even though
other streams would move.
Pulseaudio DONT_MOVE works like this, and also pipewire-media-session
worked like this.
When device nodes go away, we should remove links and peer_id references
concerning them, so that we don't leave behind stale links and stale id
entries in the peer_id tables.
Also fix bug in si_flags[out_id] handling in unhandleLinkable.
Policies need to know if there are session items that are pending
activation. Linkables are not activated in the same order as nodes
appear, which causes problems for e.g. resolving target nodes, if some
of the linkables are pending.
Register linkables in create-items before they are activated. When
activation completes, remove those that did not activate successfully.
Policies can filter out inactive items by tracking active-features
flags.
If there are existing linkables that are not ready, suspend policy-node
processing, and continue it only after all linkables are ready.
This makes the configuration more consistent. The storing of the default routes
logic needs to be implemented eventually in a C module-default-routes, similar
to module-default-profile.
Persistent profiles will never change. This can be useful if we want to keep
a specific device profile even if a new one with higher priority becomes
available. For example, keep the 'off' profile instead of switching to best
profile when monitor screens is resumed.
See #138
The va_list type might not always be a pointer in some architectures, so we
cannot guarantee it will be modified after using it for a second time in another
function. This fixes the issue by using macros so args does not get copied, and
always gets modified when using it more than once.
You can now override:
* Whether to store/restore properties like volume
* Whether to store/restore the target.node
* Things like media.name/application.name/etc which affect which
entry is going to be used in the state file
Related to #169
If a stream audio node does not have the 'media.role' property set, the policy
will asign the 'Default' media role name to it. In addition to this, if the
'Default' endpoint can not be found, the policy will link the stream audio node
with the lowest priority endpoint.
Video nodes will always be handled by policy-node.lua, and they will never be
handled by policy-endpoint-client.lua
This allows users to assign a particular endpoint for streams that don't have
the 'media.role' property set.
Only the configured headset profile needs to be persistent, the switched
status and saved profile should not persist over wireplumber restart.
When devices appear initially, they should not appear as switched,
but recheck switch status.
Monitor whether streams are running or suspended. When they are
suspended, switch to normal mode.
This is required e.g. for programs such as Teams, which keep recording
streams open but inactive for their whole runtime.
Profile restore also needs to be done with a timeout, to avoid switching
rapidly when streams are moved between sources.
Use Lua tables properly as maps.
Headset profile saving does not work properly currently (only called on
metadata change; if headset-profile == current-profile, it doesn't get
saved etc.)
Change it to follow the logic:
- Each device has a "normal" and "switched" mode. The latter becomes
active if a "communication" input stream exists and the current
default sink is bluez sink. The switched mode is exited only when
there are no "communication" input streams.
- On transition normal->switched, record current profile as the "saved"
profile. Then switch to "headset" profile. If no headset profile
was saved previously, pick profile with input direction & highest
priority.
- On transition switched->normal, save currently active profile as the
"headset" profile. Then switch back to "saved" profile.
Monitor streams can be identified based on the stream.monitor property.
They should not be identified based on application name, because that
may be localized, and the previous code does not work properly on
non-English locale.