Commit graph

1618 commits

Author SHA1 Message Date
Corentin Noël
b6dd422dd2 si-audio-adapter: Reference WpTransition before passing it as callback data
Make sure to always have a valid WpTransition when used in the finish callback.

Signed-off-by: Corentin Noël <corentin.noel@collabora.com>
2022-01-05 10:28:33 +01:00
Julian Bouzas
6adccbe33d policy-node: always use the default linkable if default nodes module is loaded
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.
2022-01-05 08:57:33 +00:00
Julian Bouzas
f7dfb90db6 module-default-nodes-api: sync with core before emitting changed signal
This makes sure pipewire is not doing anything while emitting changed signal.
2022-01-05 08:57:33 +00:00
Julian Bouzas
8bbbba23ff m-default-nodes: don't reevaluate nodes if they are not ready
This makes sure nodes are ready before finding the default node, avoiding audio
glitch in wrong device if profile was also changed while changing the default
node (can happen with Gnome Sound Settings).

Since nodes are destroyed and recreated again when a device profile changes, the
only way to make sure device nodes are ready is to check the profile classes
structure, which tell us how many total nodes the device has, and then check
that those nodes exist for that device. A rescan is triggered whenever devices,
nodes or ports changed.

This patch also improves the logic when finding default nodes, allowing virtual
sources to be set as default sources.

Fixes #85 and #130
2022-01-05 08:57:33 +00:00
Julian Bouzas
76a61e43a5 m-default-nodes: set effective node metadata to NULL if node is not found
There might not be any node at all, so we need to clear the efective node
metadata.
2022-01-05 08:57:33 +00:00
Jonas Holmberg
e1602c10c5 policy-node.lua: Fix nil value indexing
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>
2022-01-05 07:04:09 +00:00
George Kiagiadakis
dc50f95910 config: add commented-out "session.suspend-timeout-seconds" option in alsa config
For the sake of discovering this more easily
2022-01-05 08:28:52 +02:00
George Kiagiadakis
03c2a3dfbd suspend-node: use a 5sec timeout by default, to be inline with the docs 2022-01-05 08:28:52 +02:00
George Kiagiadakis
74bac56aed docs: update documented versions of dependencies 2022-01-05 08:28:52 +02:00
George Kiagiadakis
a65f17d6fa docs: update the "running" instructions 2022-01-05 08:28:52 +02:00
George Kiagiadakis
1da5d11317 docs: split up and enrich configuration docs
* Add information about multiple instances
* Document better how the lua config files work
* Document how lua config files get merged from different places
* Copy over additional documentation for ALSA from pw-media-session
* Fix rst syntax issues
2022-01-05 08:28:52 +02:00
Wim Taymans
4896ad0680 json: improve json parsing
spa_json_get_string() will never write more than maxlen.
Use spa_json_parse_stringn() to perform destination length checking.
2022-01-04 16:36:15 +01:00
Wim Taymans
071ad0e43f config: add property for audio.allowed-rates 2022-01-03 16:05:17 +01:00
George Kiagiadakis
64841f5ada config: enable RT on the data thread for bluetooth nodes
Closes #132
2022-01-03 13:36:49 +02:00
George Kiagiadakis
e04acbd2a0 docs: remove protected annotations from functions to show them in the docs 2021-12-22 17:09:20 +02:00
Julian Bouzas
a59dc92928 policy: use a scheduleRescan function to avoid unneeded rescans 2021-12-22 16:52:16 +02:00
Julian Bouzas
c6445ed3db create-item: don't register item if failed to activate
Related to #128
2021-12-22 16:27:07 +02:00
George Kiagiadakis
f3f063760c si-std-link: handle node destroy events while linking is in progress
This should solve issues with stale objects lying around, printing
warnings and in some cases also crashing things

Related to #128, #78
2021-12-22 16:12:04 +02:00
George Kiagiadakis
a965196ae2 registry: ensure in-progress activations are aborted when a global is removed
If a global is removed while an activation transition is in progress
and it happens that this activation transition was triggered by an
object manager, it is theoretically possible that this object manager
will then add this proxy after the transition completes, since
the transition is holding a ref on the proxy and therefore it will
not be destroyed. This ensures that the transitions are stopped on time
and the ref is dropped.

Because of this change, it is now also necessary to destroy the pw_proxy
on WpProxy's dispose() function, because if a proxy is removed before
it is bound, the registry aborts the activation but wp_proxy_deactivate()
is not destroying the proxy, since FEATURE_BOUND is not active.
In dispose() we can guarantee that the pw_proxy is destroyed.
2021-12-22 12:51:37 +02:00
George Kiagiadakis
a2921d78db pipewire-obj-mixin: guard against proxy being destroyed while syncing to core 2021-12-21 20:06:07 +02:00
George Kiagiadakis
57d60c383c core: add wp_core_sync_closure()
A variant of wp_core_sync() that can be used with a GClosure
2021-12-21 20:03:58 +02:00
George Kiagiadakis
bc3d9da5f8 object-manager: doc: add note about the installed signal 2021-12-21 12:51:10 +02:00
George Kiagiadakis
5412ca972f log: guard against NULL messages
if for any reason the message field is NULL, replace it with the string
"(null)" and keep going... this avoids crashing the journald logger

Fixes #124
2021-12-20 17:54:14 +02:00
Barnabás Pőcze
0ff9ea9f33 meson.build: add devenv
meson devenv provides a convenient way of running the application
without installing it by overriding certain environment variables.
meson automatically overrides PATH and LD_LIBRARY_PATH, thus
there is no need to manually set those.

Running `meson devenv -C <builddir>` opens a new shell in the
build directory with the environment variables set up.
2021-12-20 10:06:36 +00:00
Julian Bouzas
f8d60fcecd m-device-activation: reevaluate current profile if params changed
This also uses the same reevaluation logic as pipewire-media-session.

Fixes #98 and #118
2021-12-20 09:54:05 +00:00
Julian Bouzas
4997e2eb19 m-default-profile: only store the default profile if the save flag is present
Also refactors module to use params-changed signal.
2021-12-20 09:54:05 +00:00
Julian Bouzas
86d85584b2 m-mixer-api: unset iterator value before breaking or returning from loop 2021-12-20 09:54:05 +00:00
Julian Bouzas
c61ab61ece pipewire-object-mixin: enable feature info when event info is fully processed 2021-12-20 09:54:05 +00:00
Julian Bouzas
4679a4ed71 metadata: unset iterator value before breaking or returning from loop 2021-12-20 09:54:05 +00:00
Barnabás Pőcze
6d7ae691b3 pipewire-object-mixin: use 64-bit type for change_mask
All core `pw_*_info` structures have a 64-bit change mask.
However, the `change_mask` in the session manager extension
info structures is only 32-bit. The differing sizes can cause
problems, especially on big endian architectures at the moment.

See #49
2021-12-15 10:58:37 +01:00
Julian Bouzas
664998c3de meson: set minimum pipewire version to 0.3.41 2021-12-13 08:37:07 -05:00
Julian Bouzas
2af63b20df si-standard-link: return transition error once even if multiple links failed 2021-12-13 08:37:07 -05:00
Julian Bouzas
844100360c proxy: abort activation if error or destroyed
This fixes a race condition that can happen when a proxy requests a new feature
(for example WP_NODE_FEATURE_PORTS) and PipeWire destroys the proxy before the
activation finishes. This race condition was causing the current activation
transition of a proxy to never finish, creating a memory leak because the
transition holds a strong reference of the proxy. Appart from this, since the
activation never finishes, WirePlumber could wait forever and not respond to
other requests.

This also removes the wp_proxy_watch_bind_error() API for subclasses as it is
not needed anymore.
2021-12-13 08:37:07 -05:00
Julian Bouzas
93c0b48bd9 object: add new _abort_activation API
Allows aborting an object activation by returning a transition error for all
pending transitions.
2021-12-13 08:37:01 -05:00
Julian Bouzas
7483f3573f docs: update daemon configuration to match new config files
Fixes #68
2021-12-10 07:20:34 -05:00
Julian Bouzas
22fd4292ab default-routes.lua: reevaluate current profile only for its own routes
Only check the current active profile when some routes changed that are part of
the profile. If some other route changed, just ignore it.
2021-12-07 14:20:31 -05:00
iczero
a452250b47 scripts: also look in $XDG_CONFIG_HOME/scripts 2021-12-06 14:47:49 +00:00
Julian Bouzas
e3a161273d m-device-activation: set best profile if default is not available 2021-12-06 12:10:41 +00:00
Torkel Niklasson
be7b95cd3c policy-node.lua: Fix si_link activation failure handling
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.
2021-12-02 15:07:11 +01:00
George Kiagiadakis
69bd1e51ce default-routes: make the default volume configurable 2021-11-30 19:30:25 +02:00
Wim Taymans
703c35cfd4 access-config: add restricted access permissions
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
2021-11-29 09:25:18 +01:00
George Kiagiadakis
147f235f54 policy-node: don't crash if device.id is not set on a target 2021-11-26 19:57:17 +02:00
Ashok Sidipotu
52980fb770 policy-node: improve default device selection logic
- skip target device if it does not have active/available
routes

Fixes #74
2021-11-26 14:43:04 +00:00
Pauli Virtanen
95d1423677 wp: fixup tmp_global exposition with removed objects
Consider invalid id as removed marker, similarly as in the preceding for
loop.  This condition should currently not be possible to hit in
practice, but better to clean up.
2021-11-25 16:39:11 +00:00
Pauli Virtanen
9d938c5c82 wp: add an assert to guard against id race conditions arising
The WpGlobalProxy and WpGlobal should be 1-to-1, so check this before
binding proxies from globals.
2021-11-25 16:39:11 +00:00
Julian Bouzas
49f1ead1a7 si-standard-link: always return transition error if activation fails
Avoids having the session item in an invalid state.
2021-11-25 16:06:17 +00:00
Julian Bouzas
9ed6af021f si-audio-adapter: always return task error if set ports format fails
Avoids having the session item in an invalid state.
2021-11-25 16:06:17 +00:00
Julian Bouzas
45d567b488 si-audio-adapter: clean up unneeded code when setting ports format 2021-11-25 16:06:17 +00:00
Wim Taymans
efd2458418 alsa: handle the release-requested signal
Handle the release-requested signal by destroying the device and
then calling release.

Fixes pipewire/pipewire#1846
2021-11-23 13:17:29 +01:00
Wim Taymans
c88fbd20e6 Revert "policy-node: Remove direction check"
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.
2021-11-23 11:47:08 +01:00