Commit graph

3003 commits

Author SHA1 Message Date
Wim Taymans
f31d87cfee modules: return -EINVAL on invalid port 2023-12-11 10:03:51 +01:00
Pauli Virtanen
4e2057930f pulse-server: update all params only after enumeration complete
For params that don't emit change events, the param enumeration does not
start core sync, and its enumeration may be incomplete if a previous
core sync completes first.

Fix by always starting a core sync if we are updating params.

This fixes dev_info.active_port being sporadically SPA_ID_INVALID if
there is event pressure, which causes do_set_volume randomly set the
volume on the node instead of setting it on the device.  This can be
triggered e.g. by shaking the volume slider in Pavucontrol with mouse.
2023-12-09 11:23:25 +00:00
Wim Taymans
cfd422854f module-x11-bell: force pulse backend
The libcanberra ALSA backend has some races and causes crashes, we
should try to not use that one.

Fixes #3688
2023-12-05 16:20:40 +01:00
Wim Taymans
425c849042 avoid compiler warning 2023-12-04 12:24:24 +01:00
Barnabás Pőcze
539115fc59 pipewire: module-filter-chain: dsp_ops_init(): take cpu_flags
Instead of relying on the caller to initialize `dsp_ops::cpu_flags`,
take it as an argument.
2023-12-02 20:24:33 +00:00
Barnabás Pőcze
75c77b9116 pipewire: module-filter-chain: builtin_plugin: fix filename leak
The `filenames` array must be cleared before the `samples == NULL`
check otherwise the `strdup()`ed strings will be leaked in case
of failure.
2023-12-02 20:24:33 +00:00
Wim Taymans
6c772a1843 module-pulse-tunnel: don't block the main thread
Do the pulse context and stream connect async so that we don't have to
block the main thread.

Fixes #3221
2023-11-30 10:42:48 +01:00
Pauli Virtanen
08a4590070 module-access: recognize "allowed" as legacy alias for "unrestricted"
Previously, it was an alias for "unrestricted" so support that still if
access.legacy=true.
2023-11-29 18:44:49 +02:00
Wim Taymans
1a83ce0908 module-loopback: improve channel remapping support
Convert capture and playback streams to any global channel position that
has been set. This can then be used to implement an upmix sink and add
such an example config.
2023-11-29 16:07:54 +01:00
Wim Taymans
b9e5dde4ac client-node: keep target fd up to date
Keep the target and source fd in sync when we get the new fd from the
server in remote-node.

This makes it possible to refactor some things and only schedule nodes
by triggering the target.
2023-11-28 16:23:00 +01:00
Barnabás Pőcze
d88def09bd pipewire: module-roc-{sink,source}: add rudimentary ROC_INTERFACE_AUDIO_CONTROL support 2023-11-23 17:21:39 +01:00
Barnabás Pőcze
b19d0ffbc3 pipewire: module-roc-source: use SPA_NSEC_PER_MSEC instead of hard-coding 2023-11-23 15:12:50 +01:00
Barnabás Pőcze
b5e898ee83 pipewire: module-roc-{sink,source}: do not remove from argument property list
The property list is destroyed and not kept around, not passed
to any other component, so this is unnecessary work.
2023-11-23 15:12:50 +01:00
Barnabás Pőcze
68c0a13694 pipewire: module-roc-{sink,source}: pass 0 to pw_properties_get_uint32()
There is no reason to use `data->rate` as the default value
since it will be zero, so just pass 0 explicitly.
2023-11-23 15:12:50 +01:00
Barnabás Pőcze
0a3bd825cd pipewire: module-roc-{sink,source}: remove props member
The `props` member was not used at all, so get rid of it.
2023-11-23 15:12:47 +01:00
Barnabás Pőcze
6d8a31a3e4 pipewire: module-roc-{sink,source}: deduplicate protocol selection 2023-11-23 14:12:35 +01:00
Barnabás Pőcze
333fd8d2ae pipewire: module-roc-{sink,source}: port to ROC v0.3.X
ROC 0.3 introduced breaking changes, so adjust the code.
Also set the minimum supported ROC version to 0.3.0.

Fixes #3667
2023-11-23 14:12:35 +01:00
Arun Raghavan
63bb128948 rtp-stream: Set rtp.ptime on senders not receivers
The pw_stream direction is inverted from what we want (input => sender).
2023-11-23 01:28:20 -05:00
Barnabás Pőcze
aa681365c3 pipewire: module-filter-chain: fix buffer memory leaks
`impl::{silence_data,discard_data}` were not freed either
in case of an initialization error or graceful shutdown.
2023-11-23 05:50:17 +00:00
Wim Taymans
de954655bc modules: fix doc 2023-11-22 17:48:05 +01:00
Wim Taymans
bb82ddb601 Fix a warning
../src/modules/module-rt.c:615:21: warning: suggest parentheses around
assignment used as truth value [-Wparentheses]
2023-11-22 16:17:08 +01:00
Jonas Holmberg
72323dcaf3 module-rt: Protect setrlimit() with mutex
Make sure threads initializing the module doesn't get/set RLIMIT_RTTIME
simultaneously.
2023-11-22 13:56:15 +00:00
Wim Taymans
0c857f5455 pulse-server: add stream/device state in dev_info
Also include and update the state of the device/stream in
collect_device_info so that we can compare it against the previous value
and emit a change event.

Fixes #3660
2023-11-20 11:39:31 +01:00
Pauli Virtanen
90bd9adb6b pulse-server: rename combine sinks option
Let's call it "sinks" in the docs, but keep the Pulseaudio name for
backward compat.
2023-11-20 08:41:13 +00:00
Pauli Virtanen
fdcb02ed75 modules: add Module Name section to the module reference docs 2023-11-20 08:41:13 +00:00
Pauli Virtanen
843e733479 doc: add documentation for pipewire-pulse modules
Add (minimal) reference documentation for each pipewire-pulse module.

Add some preprocessing to substitute @pulse_module_options@ in docs from
PW_KEY_MODULE_USAGE so the module options don't need to be repeated.

Produce Doxygen docs + generate manpages pipewire-pulse-modules.7,
pipewire-pulse-module-*.7
2023-11-20 08:41:13 +00:00
Wim Taymans
0ae797ea28 client-node: handle port_buffers errors better
First check if all of the new buffers are ok before attemping to replace
our exising ones with the new ones. Else we might end up copying some
of the new buffers and cleaning them up twice later.
2023-11-20 09:36:02 +01:00
Pauli Virtanen
eca773fc12 modules: strip "PipeWire Module:" from Doxygen page name
Make them appear nicer in the output.
2023-11-19 16:39:15 +00:00
Pauli Virtanen
7f5f88c04a client-node: store mix in pw_map so that they are not copied
struct mix contain pointers to themselves (see do_port_use_buffers) and
cannot be copied by value, so they should not be stored in pw_array.

Store them in pw_map instead.
2023-11-19 18:03:36 +02:00
Wim Taymans
44bfeaac6e client-node: close fds in port_buffers() error case
When port_buffers are configured on a destroyed or invalid port, close
the fds or else we leak them.
2023-11-17 15:22:56 +01:00
Jonas Holmberg
0ecc7ca5f5 module-rt: Remove RLIMIT_RTTIME while trying rt policy
Trying rt scheduling policy while RLIMIT_RTTIME is set could result in
SIGXCPU if the limit is exceeded. Set an infinite limit temporarily
while checking if rt policy is allowed.
2023-11-15 17:11:19 +01:00
Wim Taymans
0278695e7d modules: add tunnel.may-pause option for pipe-tunnel
To override the default may-pause behaviour of streams.
2023-11-15 13:02:08 +01:00
Wim Taymans
63385cedd0 modules: add pause support for pipe-tunnel
Streams are allowed to pause/resume when the pipe xruns.
Wait for IO_IN or IO_OUT when the ringbuffer xruns to resume playback or
capture.

Fixes #3197
2023-11-15 12:52:10 +01:00
Wim Taymans
142b660e7b modules: make better media.name for RAOP sink
Use the destination in the media.name so that it becomes unique and the
volumes can be restored per destination.

Fixes #3801
2023-11-14 15:06:42 +01:00
WalkerGriggs
03b1d9589b
modules: Check for opus custom functions in addition to headers 2023-11-10 09:57:53 -08:00
Pauli Virtanen
72c9fba6d2 module-protocol-native: emit error on bad concurrency
Emit error if message construction is not holding appropriate locks or
runs from wrong thread, so that the flush may be running concurrently.

This generally causes corrputed messages to be sent silently, and can be
fairly hard to debug otherwise in client applications.
2023-11-07 18:07:32 +00:00
James Calligeros
70d2b0eeb4
module-rt: enable setting UCLAMP_MIN and UCLAMP_MAX values
Modern heterogenous multiprocessor systems rely increasingly on
scheduler hinting for efficiency gains and system optimisation.
This is especially true on embedded systems, where background
tasks such as audio daemons should be consigned to the most
power-efficient core in the system. Left to its own devices, the
Linux Completely Fair Scheduler tends to migrate Pipewire to
more performant cores, even when this is unnecessary.

Luckily, CFS can be told by a task to clamp its utilisation values.
Coupled with energy-aware scheduling, this allows the scheduler to
make better informed decisions about where tasks should be placed,
and what pstate to set for the CPU it is running on.

Enable the user to configure UCLAMP_MIN and UCLAMP_MAX values via
arguments to libpipewire-module-rt.

Signed-off-by: James Calligeros <jcalligeros99@gmail.com>
2023-11-06 18:43:46 +10:00
Arun Raghavan
5617fa0501 module-rtp-sap/sink: try to bind sockets to an explicit interface 2023-10-24 07:17:21 +00:00
Pauli Virtanen
9eaf1184c2 module-protocol-native: multiple names to try in PW_KEY_REMOTE_NAME
Allow PIPEWIRE_REMOTE / PW_KEY_REMOTE_NAME to contain a JSON array of
sockets to try to connect to, in order, instead of just one name.

JSON is restricted to utf-8 encoding. Also, this forces using JSON
syntax for paths that start with '['. This probably will not usually
cause much problem.
2023-10-24 07:08:07 +00:00
Wim Taymans
970a837670 filter-chain: add mult and sine plugin
mult is to multiple samples, sine to generate a sine wave. This can be
used to make a tremolo effect.
2023-10-23 11:14:51 +02:00
Wim Taymans
69134f8d3e filter-chain: add linear operation to dsp 2023-10-22 10:50:03 +02:00
Wim Taymans
1b09c4a2cc filter-chain: add more math functions
Add clamp, recip, exp, log
2023-10-22 09:41:05 +02:00
Wim Taymans
93d5848031 module-echo-cancel: playback and source are async
The playback and source streams don't dequeue/queue buffers from
the process function and so need to be marked async.

Fixes #3593
2023-10-21 09:27:43 +02:00
Wim Taymans
0ff4844d87 filter-chain: remove some debug 2023-10-20 20:39:06 +02:00
Wim Taymans
8a9a4723f2 filter-chain: add linear transform filter
Transforms samples or control with v * mult + add
2023-10-20 20:37:50 +02:00
Wim Taymans
07696d5d57 filter-chain: also handle notify ports as dependencies
The links from the notify ports to other nodes decrement the
dependencies.

See #3596
2023-10-20 17:29:55 +02:00
George Kiagiadakis
8735d07c0a combine-stream: add support for "on-demand" streams
Instead of just following static target match rules to create output streams,
this feature allows the user to dynamically create more output streams
with custom targets using metadata.
2023-10-17 19:38:03 +03:00
Pauli Virtanen
f89757e1f6 module-access: add access.socket option + legacy mode, remove other options
Add access.socket option, which sets PW_KEY_ACCESS based only on which
socket the client connected from.

Remove the executable-based permissions and all old options.  Add
access.legacy=true option that enables the old default behavior.  The
legacy mode cannot be used together with the socket-based access.

Emit warnings if any of the removed old options have been set.

Set pipewire.sec.flatpak=true for Flatpak applications.

The socket-based access ignores PW_KEY_CLIENT_ACCESS and the Flatpak
status when setting PW_KEY_ACCESS.  Dealing with them becomes
responsibility of the session manager (or equivalent) which processes
the permission rules.

Make the default access.socket value compatible with the
module-protocol-native default two-socket configuration.

However, if neither access.socket or access.legacy is specified, we will
for now use the legacy mode for backward compatibility.
2023-10-16 22:17:44 +03:00
Pauli Virtanen
3d32291711 module-protocol-native: use two-socket server by default
If no socket configuration specified for a server, create two sockets,
"CORENAME" and "CORENAME-manager" where CORENAME is the value computed
by get_server_name.
2023-10-16 22:17:44 +03:00
Wim Taymans
d2b6a76798 modules: the combined streams are always async
We never trigger processing from their callbacks in all cases so they
need one extra buffer.
2023-10-16 10:42:39 +02:00