Commit graph

1701 commits

Author SHA1 Message Date
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
Wim Taymans
afbc0ce57a si-audio-adapter: relax format parsing
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
2022-02-25 16:47:09 +00:00
Julian Bouzas
33d105c2b6 conf: add property to disable dummy AVRCP player in bluetooth.conf 2022-02-25 16:41:49 +00: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
Julian Bouzas
8f4a848223 object: abort queued transitions if current transition failed. 2022-02-21 09:37:44 -05:00
Marko Gobin
b8b3f17181 config: add more chromium based browsers to media-role.applications 2022-02-21 07:42:11 +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
George Kiagiadakis
0e3505c740 gitlab-ci: update ci-templates, fedora version and coverity version 2022-02-16 17:13:46 +02:00
Julian Bouzas
2a6902a634 spa-json: fix format and remove unneded WP_API 2022-02-15 16:19:47 -05:00
George Kiagiadakis
c4c5ca8e22 policy-bluetooth: fix string.find crash with nil string
Fixes #193
2022-02-14 10:38:51 +02:00
Julian Bouzas
e429db7e8c spa-json: fix va_list APIs for different architectures
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.
2022-02-09 07:59:59 -05:00
Wim Taymans
88d9b30d7a lib: remove some listeners 2022-02-09 12:38:27 +01:00
George Kiagiadakis
5f96f69218 restore-stream: do not crash if config.properties is nil
Fixes #190
2022-02-09 13:35:13 +02:00
George Kiagiadakis
e14bb72dcc release 0.4.8 2022-02-07 18:52:10 +02:00
George Kiagiadakis
3731766a19 meson: require pipewire 0.3.45 for pw_context_conf_section_for_each() 2022-02-07 17:53:17 +02:00
Julian Bouzas
961771fb93 docs: add WpSpaJson C API Documentation files 2022-02-07 15:29:20 +00:00
Julian Bouzas
c4335afc51 policy-node: find best linkable if default node passthrough is not compatible
Fixes #178
2022-02-07 09:52:43 -05:00
Wim Taymans
13034fad75 main: use pw_context_conf_section_for_each()
So that we can let the config system load fragments from multiple
places later.
2022-02-03 12:53:56 +00:00
George Kiagiadakis
2ece785e85 restore-stream: export the route-settings metadata again 2022-02-03 13:05:20 +02:00
George Kiagiadakis
ca906362cd lua-scripting: expose WpImplMetadata on the API 2022-02-03 13:04:55 +02:00
George Kiagiadakis
5028737032 restore-stream: add rules matching to allow overriding things per stream
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
2022-02-03 12:07:00 +02:00
Julian Bouzas
5f2da84d51 config: move restore-stream.lua configuration in its own file
Also makes restoring the stream properties and target optional.
2022-02-02 18:37:39 +00:00
Julian Bouzas
b1b603443f restore-stream: use the new Json API and remove route-settings-api module 2022-02-02 18:37:39 +00:00
Julian Bouzas
e495d4920d policy-endpint: add support for stream audio nodes without media.role
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.
2022-02-02 11:37:00 -05:00
Pauli Virtanen
453a7e9325 scripts: policy-bluetooth: don't switch if already have input route
If the current profile has input route, don't switch to a different
profile. Instead, consider the current profile as the new headset
profile.
2022-02-02 10:33:24 +00:00
Pauli Virtanen
5a108a7c3f scripts: policy-bluetooth: save only necessary state on disk
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.
2022-02-02 10:33:24 +00:00
Pauli Virtanen
4dbf4f2b82 scripts: policy-bluetooth: monitor whether streams are running
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.
2022-02-02 10:33:24 +00:00
Pauli Virtanen
1fa65bf5b7 scripts: policy-bluetooth: save profiles by name, not index
The profile index may change, if the set of profiles on the device
changes, and is better to not use it for saving long-term.
2022-02-02 10:33:24 +00:00
Pauli Virtanen
ab725987d7 scripts: policy-bluetooth: fix headset profile saving
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.
2022-02-02 10:33:24 +00:00
Pauli Virtanen
c1f5e57047 scripts: policy-bluetooth: fix state_table usage
State saves everything as strings, so the get* routines have to convert
back.
2022-02-02 10:33:24 +00:00
Pauli Virtanen
2b1ee0c5b9 scripts: policy-bluetooth: ignore monitor streams properly
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.
2022-02-02 10:33:24 +00:00
Julian Bouzas
585ad72c7c spa-json: add null character when finishing building json 2022-02-01 16:07:12 +00:00
Julian Bouzas
384c5775f8 default-nodes: add option to auto-switch to echo-cancel nodes
This option is enabled by default now.
2022-01-27 14:55:21 -05:00
Julian Bouzas
2ba94f632b policy-node: schedule rescan if device params changed
Allows auto-switching to headphones if echo-cancel module is enabled, and the
audio device has different nodes for speakers and headephones.
2022-01-27 11:25:58 -05:00
Niklas Furtwängler
da023e1834 conf: added ability to disable MIDI functionality entirely 2022-01-27 15:22:33 +00:00
Julian Bouzas
b0ddd6f890 m-lua-scripting: add Json.Raw constructor 2022-01-26 09:53:24 -05:00
George Kiagiadakis
cfee1f0c65 wpctl: ensure that the result of strtol() is < G_MAXUINT32
Fixes overflows on 64-bit architectures

Closes #173
2022-01-26 15:09:55 +02:00
Julian Bouzas
46ab414a04 spa-json: fix coverity scan issues 2022-01-25 21:18:16 -05:00
Julian Bouzas
5bef0f240f default-nodes: use WpSpaJson API 2022-01-25 07:40:59 -05:00
Julian Bouzas
20187e07b5 m-lua-scripting: add WpSpaJson API 2022-01-25 07:20:35 -05:00
Julian Bouzas
4c1574117a spa-json: add new WpSpaJson API 2022-01-25 07:20:35 -05:00
Julian Bouzas
0272e11c53 wpctl: add clear-default option to clear default configured node names
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.
2022-01-25 09:57:33 +00:00
Julian Bouzas
95e7c4abe8 m-default-nodes-api: add API to get and set default configured node name 2022-01-25 09:57:33 +00:00
Julian Bouzas
10531e95b5 default-nodes: reevaluate when device params changed
Some devices have different nodes for speakers and headphones. In that scenario,
this change notifies the policy to re-link all clients to the new default node
when the user plugs and unplugs the headset.
2022-01-24 16:18:31 -05:00