Commit graph

227 commits

Author SHA1 Message Date
Wim Taymans
3e63610bc5 access-portal: re-evaluate permission when a camera is added
When a new camera is added, go over all clients and update the
permissions for the new camera.

This makes it possible to plug in a new camera and make it visible to
the portal apps.
2022-11-14 13:08:09 +01:00
Ashok Sidipotu
e77ad8c0c0 alsa.lua: remove the disabled entities from the names table
entities here are the device cards and the device nodes.

sometimes null device objects are reported by monitor, this results in lua
exceptions handle this use case.

Fixes #361
2022-11-08 14:55:40 +00:00
Pauli Virtanen
f79a330849 scripts: policy-node: wait for unactivated links instead of removing
If a link is not activated, don't remove it. Instead, schedule a rescan
when a link activates, so that we'll handle it once it does.

This is a workaround for some problems, see
https://github.com/Audio4Linux/JDSP4Linux/issues/74
However, the underlying cause is not understood.
2022-11-07 11:45:21 +00:00
George Kiagiadakis
8fa1693919 Apply 1 suggestion(s) to 1 file(s) 2022-09-28 14:39:30 +00:00
Dmitry Sharshakov
6002cea116 alsa-midi: move MIDI bridge properties into a table
Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com>
2022-09-28 14:39:30 +00:00
Dmitry Sharshakov
b86847ec75 alsa-midi: add an option to disable longname/card number display
Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com>
2022-09-28 14:39:30 +00:00
Pauli Virtanen
40e7ad5ccc bluez: use device id instead of profile name in node names
Don't include profile name in node names for HFP and A2DP.  Instead,
append the id number from the spa.bluez5 backend.  The backend takes
care of choosing the unique id numbers appropriately.

This makes the sink/source names the same for A2DP and HFP.  This allows
outputs directed to the Bluetooth device to remain there when switching
profiles between A2DP and HFP, without needing to determine the new
sink/source name.
2022-09-27 07:49:52 +00:00
Frédéric Danis
591f2e77e9 scripts: bluez: Autoconnect bap-sink stream on peripheral/acceptor 2022-09-15 13:21:37 +02:00
Frédéric Danis
57518ed2ce scripts: bluez: Autoconnect media.source stream
New version of PipeWire replaced a2dp.source stream by more generic
media.source stream.
Keep the former for compatibility.
2022-09-15 13:21:37 +02:00
Pauli Virtanen
37c839b930 policy-node: fix potential rescan loop
SiLink activation might be delayed indefinitely under some error
conditions. Currently, policy-node schedules a rescan when it sees a
non-activated link on a stream to be moved, which produces busy loop if
the si-link doesn't activate.

Instead of rescheduling on non-active si-links, just remove and emit a
warning. The si-link then gets removed once it gets activated.

Reproducer:

1. Play audio from Rhythmbox and pause.
2. Switch default output with pactl between two different outputs
3. Links from the paused stream stay at "init"
2022-08-14 19:47:11 +00:00
Julian Bouzas
7a70b04237 policy-device-profile: set best profile even if it has not changed
We want to set the best profile even if it has not changed, because it can be
different than the active profile.

Fixes #329
2022-07-31 10:09:32 -04:00
Fabian Vogt
d5029697de Fix leftover use of module-reserve-device's state property
The move to the WpDbus API dropped the "state" property from the plugin,
but left the property enum and use of it in alsa.lua. Remove the enum and
port over the code in alsa.lua.
2022-07-14 13:02:19 +00:00
Pauli Virtanen
aee4fe2579 policy-device-routes: consider routes only for active profile
If a route specifies a set of profiles, it should not be used if the
profile is not in that list.

In findBest/SavedRoute, exclude routes that don't match the active
profile.

Currently in the SPA devices, the device id is different for different
profiles so this condition does not occur, but in general this might not
be so.
2022-07-07 18:28:24 +00:00
Pauli Virtanen
73b0dccb8d policy-default-routes: use different default volume for input direction
Input direction volume doesn't need a safety margin.
2022-07-07 18:10:11 +00:00
Pauli Virtanen
affdf36a29 policy-device-routes: change default volume to 0.4 on cubic scale
It's safer to have the default volume value at significant attenuation,
to mitigate situations where the output is at high gain.

Use linear scale 0.4^3 (-24 dB), which puts Pulseaudio volume sliders at
40%, as a better starting value than 0.4 (-8 dB / 74%).  E.g. for many
Bluetooth headphones, the volume at 74% is still uncomfortably high, and
a lower value is better.
2022-07-07 18:10:11 +00:00
George Kiagiadakis
c16e637c32 alsa: use "obj_type" as a variable name to avoid shadowing lua's "type" function
This causes a crash when running in a VM because the code tries to
execute lua's "type()" and ends up executing the local string variable...

Fixes: #303
2022-07-07 20:58:36 +03:00
George Kiagiadakis
37bd392119 alsa: add mechanism to override node default properties for VMs
Fixes #162, #134
2022-06-28 14:31:17 +03:00
George Kiagiadakis
d7f17104bf policy-device-profile: always consider the stored default profile when re-evaluating
Fixes: #179
2022-06-28 08:30:10 +00:00
Julian Bouzas
392bd81913 alsa.lua: remove node names from table when parent device is destroyed
Fixes #293
2022-06-27 08:52:36 +00:00
Julian Bouzas
46e7c5c144 m-reserve-device: use WpDbus API 2022-06-02 12:34:16 -04:00
George Kiagiadakis
2ac384711d libcamera: give higher priority to external cameras
if you have plugged an external camera, that probably means you
prefer using that instead of the internal one
2022-05-31 12:15:11 +03:00
George Kiagiadakis
334a134471 v4l2: append "(V4L2)" in node descriptions
This is to make it easier to work with V4L2 and libcamera simultaneously
2022-05-31 10:53:01 +03:00
George Kiagiadakis
b44759ec3f libcamera: improve the front/back camera descriptions 2022-05-31 10:41:20 +03:00
George Kiagiadakis
6931050b7f v4l2/libcamera: set node.nick on nodes 2022-05-31 10:40:56 +03:00
George Kiagiadakis
2299c389b5 libcamera: set a user-friendly description for internal cameras 2022-05-30 11:06:46 +03:00
George Kiagiadakis
9ec2757d27 monitors: enable libcamera by default and set priority on all camera nodes
Currently v4l2 nodes will get higher priority than libcamera ones.
The default can be changed, of course, with wpctl.

Things are still not great if a camera is enumerated by both monitors.
The first node to be linked will grab the device and the second one
from the other subsystem will fail to negotiate.
2022-05-26 14:08:16 +03:00
Julian Bouzas
c00c5a6675 alsa.lua: fix device name deduplication when reservation is enabled
Fixes #241
2022-05-19 07:43:12 -04:00
Julian Bouzas
7080e9961c policy-node: forward filter stream's format to filter device
Currently, when using filter nodes such as echo-cancel or filer-chain, the
ports format of the virtual stream node might not always match the format of its
associated virtual device node. This can happen if the virtual stream node is
linked with a real device node configured with many channels, such as surround
profile. In that case, the channel configuration is not forwarded to the virtual
device node, making the application not being aware of a surround setup.

This change listens for port format changes in the virtual stream nodes, and
reconfigures the virtual device node ports everytime the virtual stream node's
port format changes.

This behavior is experimental and optional, so it is disabled by default.
2022-05-05 08:09:21 +00:00
msizanoen1
a2472542a9 scripts: access-portal: Fix incorrect bitmask checking for media roles
In Lua, `0` is a truthy value, which means `not 0` is `false`. Compare
the resulting value from bitwise AND with 0 instead of checking it with
`if not` to ensure correctness.
2022-04-15 13:23:19 +07:00
Pauli Virtanen
6feecab74e scripts: translate user-visible strings in alsa.lua 2022-04-11 19:20:43 +03:00
Frédéric Danis
57769c2071 scripts: Add script to create fallback sink
This script, base on PipeWire module fallback-sink will create a fallback
sink node if there's no other sink available except the endpoints created
by WirePlumber.
2022-04-04 13:18:34 +00:00
Pauli Virtanen
da5d25acbe scripts: policy-device-profile: clear tables when devices removed
When device ids are invalidated, clear all local tables about them,
because the id may be reused by different object, or the same object
reappearing.
2022-04-04 09:44:43 +00:00
George Kiagiadakis
8738955723 suspend-node: trigger idle timeout also if a node goes into "error" state
This is what media-session does as well and allows recovering from
errors without having to restart wireplumber
2022-04-04 11:31:37 +03:00
Pauli Virtanen
812fc9b6b1 scripts: policy-node: filter-like streams should not follow default
Filter-like streams (e.g. output stream from filter-chain) should not
start following default sink, as usually the user intends their routing
to remain static, and not change unless explicitly requested.
Pulseaudio has special handling for streams associated with filter
sinks/sources, and does not make such streams follow default.

Use presence of node.link-group to determine which streams are
associated with filter sinks/sources, and don't make them to follow
default.
2022-03-27 15:12:20 +03:00
Wim Taymans
0747d34e44 alsa: fixup node.nick
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.
2022-03-08 11:03:24 +00:00
Ashok Sidipotu
72f4f19cbf policy-endpoint-device: Fix endpoints not connected with devices
-if device linkables are created ahead of the endpoints,
 endpoints are not connected with the devices.

-rescan the endpoints on an endpoint creation.
2022-03-08 10:08:55 +00:00
Pauli Virtanen
03c6fb0a86 scripts: bluez: set icon name for bluez devices 2022-03-08 09:56:28 +00:00
Pauli Virtanen
398bcca00d scripts: restore-stream: handle target.object 2022-03-08 09:49:55 +00:00
Pauli Virtanen
5872dc9408 policy-node: handle nodes-follow-default in handleLinkable
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.
2022-03-08 09:49:55 +00:00
Pauli Virtanen
e4325bc41d policy-node: support target.object key
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.
2022-03-08 09:49:55 +00:00
George Kiagiadakis
b95da3393c alsa: also try the profile description if the pcm name is empty, for node.nick 2022-03-01 12:11:25 +02:00
George Kiagiadakis
4e5af26382 alsa: use the pcm name to populate the node.nick
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.
2022-03-01 11:35:55 +02:00
Pauli Virtanen
2c58de2cc5 scripts: policy-node: don't use fallback for dont-reconnect w/ target
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.
2022-02-25 16:39:12 +00:00
Pauli Virtanen
d303534cba policy-node: don't move already linked dont-reconnect nodes
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.
2022-02-25 16:33:46 +00:00
Pauli Virtanen
54894eabb7 scripts: policy-node: handle device linkable removal
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.
2022-02-25 16:33:46 +00:00
Julian Bouzas
6133d85392 policy-device-profile: Don't restore if active profile is persistent and default
Fixes #204
2022-02-25 16:11:40 +00:00
Pauli Virtanen
c6aa44ca26 policy-node/create-item: fix handling of linkables pending activation
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.
2022-02-20 21:59:39 +02:00
Julian Bouzas
edf0dc69d1 config: rename default-routes.lua to policy-device-routes.lua
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.
2022-02-16 13:37:40 -05:00
Julian Bouzas
2d303cf6a9 policy-device-profile: add option to set persistent profiles
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
2022-02-16 13:37:40 -05:00
Julian Bouzas
b3446efa16 config: port device-activation module to policy-device.profile.lua
Because all wireplumber policies are in Lua.
2022-02-16 13:37:40 -05:00