Commit graph

6195 commits

Author SHA1 Message Date
Barnabás Pőcze
f66e631a53 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-04 11:18:52 +01:00
Pauli Virtanen
2252813358 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-12-04 11:17:45 +01:00
Dmitry Sharshakov
979ad775d3 aes67: bump PTP0 driver priority
As reported in #3217, PTP driver has to have the highest priority for packets to arrive in time

Everything connected to AES67 should be clocked by the Grandmaster clock
2023-12-04 11:17:26 +01:00
Pauli Virtanen
4aa1deb929 meson.build: fix compile with -Dexamples=disabled 2023-12-04 11:16:11 +01:00
Wim Taymans
a336aabe43 stream: pass properties to context_new
Whe  using pw_*_new_simple(), pass the properties to the automatically
created context as well so that we can configure it.

This makes it possible to, for example, load the client-rf.conf using the
simple API as well.
2023-11-24 10:12:49 +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
Barnabás Pőcze
5d62bf5c06 pipewire: daemon: do not set G_LOG_DOMAIN
GLib has not been used for logging for a long time,
so setting this macro has no effect and is unnecessary,
so remove it.
2023-11-23 11:57:45 +00:00
Wim Taymans
c4cd8fa73d impl-client: don't log warning when updating ignored keys
If a client tries to update an ignored key, don't log a warning. Only
log a warning when one of the security properties changed.

This is what we used to do before commit
0dfa05117b

It fixes a warning when a stream disconnects and reconnects because
the serial.id changed.
2023-11-23 12:29:55 +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
Barnabás Pőcze
2738bb4cb7 pipewire: remove pw_in_valgrind()
This function is very much orthogonal in function to the usual
features provided by pipewire, and there does not seem to be any
3rd party users based on Debian Code Search and GitHub.
So let's remove it before any 3rd party users start depending on
pipewire for their valgrind detection.
2023-11-22 23:05:03 +01:00
Barnabás Pőcze
3deaa2b0df pipewire: impl-module: respect PIPEWIRE_DLCLOSE
Commit b5c21c1fbc ("pipewire: use dlclose unless PIPEWIRE_DLCLOSE is set to false")
introduced the PIPEWIRE_DLCLOSE environmental variable to
force/prevent the dlclose()ing of shared objects. However,
native pipewire modules were not adjusted to respect its value,
and instead have been still using `pw_in_valgrind()` to
determine whether or not they should be unloaded.

Fix that by adding a private `pw_should_dlclose()` function
and using that in impl-module.c:pw_impl_module_destroy().
2023-11-22 22:58:00 +01: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
Wim Taymans
aef99f840f Revert "gstpipewiresrc: break out of wait_started() also on STATE_UNCONNECTED"
This reverts commit 7465175ad0.

wait_started() is called before the stream is connecting and so
exits with an error immediately, which then makes the stream start
too early and block.
2023-11-16 09:51:11 +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
George Kiagiadakis
7465175ad0 gstpipewiresrc: break out of wait_started() also on STATE_UNCONNECTED
When the session manager sends an error to the client, it typically
also destroys the node after the error, which causes the stream to go
to STATE_UNCONNECTED via proxy_removed(). In that case, make sure
we exit the loop early, otherwise it will take 30 seconds to unblock
gst_element_set_state()
2023-11-09 20:59:40 +00:00
George Kiagiadakis
a852b979b6 gst: avoid reporting error twice
First, make the error permanent by calling pw_stream_set_error()
and when this emits an error state again, report that to GStreamer.

Do the same in pipewiresink, which didn't even have the
pw_stream_set_error() call before, so the stream wasn't really going
into an error state at all.
2023-11-09 20:59:40 +00: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
Barnabás Pőcze
b832a94f5d pipewire: utils: make pw_strv_find() take a const char *
There is no reason to take just a `char *` as the string only ever read.
2023-11-06 19:01:20 +01:00
Jonas Holmberg
0163d4d440 systemd: Limit system manager socket permissions
Remove group permission on the system manager socket so that restricted
clients cannot use it to get unrestricted access. It is assumed that the
session manager system service (wireplumber) is running as pipewire user
and will get access to the manager socket, while other clients are
members of the pipewire group and will only get access to the normal
socket.
2023-11-06 15:02:10 +00:00
Wim Taymans
35b115fd6c context: stop scanning on feedback links
If we have a feedback link around a driver, stop scanning for
runnable nodes or else we will be looping forever.

Fixes #3621
2023-11-06 15:56:36 +01: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
Pauli Virtanen
33db334765 doc: link \page and \group by \see 2023-11-04 15:22:18 +02:00
Wim Taymans
90e4ee94ec context: limit recursion in run_nodes
Limit the amount of recursion in run_nodes() for now until we find out
why it keeps on recursing.

See #3621
2023-11-03 15:40:41 +01:00
jdavidsson
baac9aa549 impl-link: reset state to INIT if not destroyed
If the link isn't destroyed, don't allow changing state to
PAUSED for states < PAUSED. For example, if the deactivation
is called during the link being in NEGOTIATING it could then
jump directly to PAUSED and believe it is prepared.

Fixes #3619
2023-11-03 10:01:48 +01:00
Théo Lebrun
38157a8937 pw-top: fix version constant used for pw_node_events
This changes the value declared (3 currently versus 0 following this
patch). I have not seen code checking this version number.

Signed-off-by: Théo Lebrun <theo.lebrun@bootlin.com>
2023-11-02 12:42:50 +01:00
Wim Taymans
bdb7f3adc8 gst: don't stop streaming when paused
We pause when we are unlinked, don't stop the streaming thread because
then we won't be able to resume when we are linked again.

Fixes #3620
2023-11-02 10:06:03 +01:00
Wim Taymans
353efbd790 context: fix indentation 2023-10-31 11:33:23 +01:00
Wim Taymans
98d44d9757 impl-node: support multiple link-group and group
Support an array for the node.group and node.link-group properties.
This makes it possible to make a node member of multiple groups and
link-groups.

See #3612
2023-10-31 10:58:49 +01:00
Wim Taymans
72fa74ff57 utils: add some utility functions for working with strv
Add function to parse strv from relaxed json syntax.
Add some functions to find a string or the first common string.
2023-10-31 10:57:25 +01:00