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.
This also improves the status output to display the configured default node
names using the new get-default-configured-node-name API, and refactors
set-default to also use the new set-default-configured-node-name API from
the default-nodes-api module.
Currently, spa-bluez5 devices start in non-off profile, which causes
m-device-activation logic to set the highest priority profile instead of
the saved one.
Fix this by having spa-bluez5 start devices in off profile, similarly as
spa-alsa does.
We now only use module-rt. Explicitly set the nice.level to -11 instead
of leaving the default (do nothing). Adjust the rt limits to their new
defaults in module-rt (unlimited).
We now only use module-rt. Explicitly set the nice.level to -11 instead
of leaving the default (do nothing). Adjust the rt limits to their
defaults in module-rt.
The "saved headset profile" is taken as the profile that was active when
the headset mode deactivates. So in case the user switches profile during
the time when the Communication input stream is active, the selected
profile is remembered next time.
When a stream gets added, we might have a situation where the device
does not yet exist to actually link on the basis of intended role. For
example this can be observed if no mic sources are present and then the
mic appears after a bluetooth profile switch to HFP.
To fix this, iterate over streams when a device connects in addition to
iterating over devices when a stream connects.
The Role traversal of config data to take notice of the
media class as well so that source and sink roles dont
overstep on each other and pick up unexpected endpoints.
This is expected to be printed if a stream opens and closes
very quickly, like in the case of pipewire-alsa opening the device
for querying formats and then closing it immediately.
If the default nodes module is loaded, and the default node is not found, it
means that there is no valid target for that session item. We only need to
manually find a default target if the default nodes module is not loaded.
Fixes the warning:
[string "policy-node.lua"]:117: attempt to index a nil value (field '?')
stack traceback:
[string "policy-node.lua"]:117: in function <[string "policy-node.lua"]:109>
If si_link fails to activate, we got an error saying
"attempt to index a nil value". This fixes the nil value problem
and also changes the warning to an info, since some of our badly
behaved apps can cause this and we don't see any problems resulting
from it.
When a pulse client connects with TCP, it is given the 'restricted'
access policy. Assign 'rx' permissions for those clients instead of
blocking forever.
See pipewire#1863
This reverts commit b6072f4179.
This is not right because when 2 nodes have the same name, there is
no way to know which one to use. It is better to rely on the
PW_KEY_STREAM_CAPTURE_SINK property when capturing from a monitor.
If we were linked before but our node is removed, wait until a new node
becomes available instead of failing.
This fixes an issue where there is only 1 sink available and the card
profile is toggeled between pro and stereo. After the profile is
toggled, the sink is removed and the node would be killed with an error
because there is no fallback sink. The fix is similar to the
pipewire-media-session logic.
Remove the direction check in findDefinedTarget. We already to a
better direction check in canLink().
This fixes the case where a capture stream has the node.target set
to a sink. The directions don't match and the capture stream is not
linked to the monitor ports of the sink. Removing the check triggers
the right logic in canLink() and obs studio can link to monitor
ports again.
It's possible that we get multiple links on the same node, ex:
player -> output (output is the selected peer)
player -> pavucontrol
When pavucontrol exits, the peer_id of player must not be cleared,
since the link to the output still exists
-loop through all the linkable nodes, instead of using default nodes
-implement a priority scheme to pick the appropriate target linkables
-If both nodes support a passthrough format, check the intersection.
If the intersection is empty and one of the node is passthrough only,
skip the node as a target
-the logic now closely aligns with the media-session logic
Fixes#75