Commit graph

11699 commits

Author SHA1 Message Date
Wim Taymans
ea412a5628 jack: fix midi events from peer port
When we get a midi buffer directly from one of our peer ports, we need
to convert it to a jack midi buffer.

Note that this previously returned NULL because of the size check of the
midi buffer, which was likely much smaller than the frames argument.

This fixes midi event recording preview in ardour.
2023-11-08 12:59:33 +01:00
Silviu Florian Barbulescu
e1fd73da66 Fix set state not seated on linked transport 2023-11-08 10:10:17 +02:00
Arun Raghavan
2871a65b1f alsa: Add a mechanism to bind ALSA controls as prop params
This adds an api.alsa.bind-ctls property to alsa-pcm sink and source
nodes, to bind a property to an ALSA PCM ctl. The property is an array
of ctl names that should be bound.

This can be handy, for example, to bind the Playback/Capture Rate
controls on a USB gadget, in order to track the PCM's state via a node
param.

This is currently wired to be read-only, but it should be easy enough to
make it writable.
2023-11-07 23:22:53 -05:00
Arun Raghavan
6bae812ce0 alsa: Share node/port info emission code between sink and source
It's mostly the same, and it allows us to trigger this code in the
shared alsa-pcm.c code as well.
2023-11-07 14:15:12 -05: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
Barnabás Pőcze
08002f0497 spa: libcamera: get rid of an unnecessary snprintf() call
Simply use the returned string for populating the spa_dict
instead of doing a copy into a fixed size buffer on the stack.
2023-11-06 19:01:20 +01:00
Barnabás Pőcze
5b128cdbe9 spa: alsa: compress-offload: use spa_assert_not_reached()
Use `spa_assert_not_reached()` instead of `assert(false)`
as it is more descriptive and the error message is clearer.
2023-11-06 19:01:20 +01:00
Barnabás Pőcze
e4d1ab0c19 spa: debug: log: use SPA_CONTAINER_OF()
Use `SPA_CONTAINER_OF()` instead of direct casting as it is
more resilient against future changes that might reorder the
members in `struct spa_debug_log_ctx`.
2023-11-06 19:01:20 +01:00
Wim Taymans
6f6bf204d6 alsa: remove redundant snd_pcm_recover()
Because we now always _drop/_prepare_/_start, the snd_pcm_recover()
before that is no longer useful.

Retry snd_pcm_resume() after suspend when -EAGAIN and fall back to
_drop/_prepare/_start when that fails.
2023-11-06 17:48:02 +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
Wim Taymans
032955fffe alsa: disable resample when pitch element is available
We need to disable the resampler when there is a pitch element. This was
correctly done in setup_matching but not in check_position_config().

See #3628
2023-11-06 15:09:35 +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
Sam James
0e35750fde
spa: bluez: fix -Walloc-size
GCC 14 introduces a new -Walloc-size included in -Wextra which gives:
```
./pipewire-0.3.84/spa/plugins/bluez5/codec-loader.c:176:14: warning: allocation of insufficient size ‘1’ for type ‘struct impl’ with size ‘1032’ [-Walloc-size]
```

The calloc prototype is:
```
void *calloc(size_t nmemb, size_t size);
```

So, just swap the number of members and size arguments to match the prototype, as
we're initialising 1 struct of size `sizeof(struct impl)`. GCC then sees we're not
doing anything wrong.

Signed-off-by: Sam James <sam@gentoo.org>
2023-11-05 21:36:49 +00:00
Pauli Virtanen
33db334765 doc: link \page and \group by \see 2023-11-04 15:22:18 +02:00
Pauli Virtanen
c77fdb4864 doc: hide useless indices in doxygen output etc. fixes
Hide useless paginated indices.
Rename "Related Pages" -> "Pages".
Fix manpage brief description.
Fix file path name stripping.
Move macro listings after enums, so that they're next to functions.
Remove pwtest from docs, it's not API.
Fixup header styles.
2023-11-04 15:22:01 +02:00
Pauli Virtanen
27afa39d5d doc: use b->requested in tutorial4 2023-11-04 14:50:45 +02:00
Pauli Virtanen
49668a9b26 doc: fixup some Doxygen autogen issues
Don't show page sections in left sidebar, it's confusing.
Rename Modules -> API Reference in sidebar.
Indicate visually the sidebar entries are collapsible.
Fix spa_pod_json grouping.
Move tools page to top level.
Fix page ordering.
2023-11-04 09:45:55 +00:00
Wim Taymans
dae0ccacfc spa: explicitly mention that volumes are linear
See #3623
2023-11-04 09:51:14 +01: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
Théo Lebrun
0e44f5ef97 jack: fix PW_VERSION_* constant used with pw_*_events structs
PW_VERSION_NODE is 3 while PW_VERSION_NODE_EVENTS is 0, I am unsure if
it could have caused issues. Same thing with PW_VERSION_PORT &
PW_VERSION_PORT_EVENTS.

I have not seen code checking this version number.

Signed-off-by: Théo Lebrun <theo.lebrun@bootlin.com>
2023-11-02 12:42:30 +01:00
Wim Taymans
cf46c4f5af 0.3.84 2023-11-02 11:13:40 +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
b8a8e00a80 jack: do sync when starting client
do a sync when starting up client and sync when creating a new proxy so
that we get all the proxy updates before the client is opened.

This ensures all ports are enumerated correctly.

Fixes #3618
2023-11-01 18:42:12 +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
Wim Taymans
9cdb3607e1 alsa: remove device properties when closed
When the device has not configured a format, remove the properties that
depend on the format so that they don't limit what we can configure the
device with next.

See #3613
2023-10-30 11:20:52 +01:00
Wim Taymans
2ff62641b9 context: when forcing rate/quantum don't limit latency
Usually, the max-latency is calculated by the device when it is
configured based on the maximum buffer size and limits the latency
change that can be done.

When we are forcing a rate/quantum and we are going to reconfigure the
device, this limit should not apply because the current buffer settings
and latency are going to change because of the reconfigure.

See #3613
2023-10-30 11:18:55 +01:00
Michael Tretter
e4def0ce18 pipewiresink: use maximum size of buffers to configure pool
For encoded formats, buffer size is the size of the actual data in the
buffer and may change for each frame depending on the content. Thus,
configuring the buffer pool of the pipewiresrc with the size of the
first buffer may be insufficient for later buffers.

Configure the buffer pool to the maximum size of the first upstream
buffer and assume that the following buffers will be allocated with the
same size as the first buffer.
2023-10-27 18:01:37 +02:00
Michael Tretter
efa08e9892 gst: update buffer size only if format defines a size
For encoded formats, p->video_info.size will be 0. If the pipewiresrc
handles an encoded format, the bufferpool will be configured to allocate
buffers of size 0. This will cause errors later when trying to copy the
frames into the pipewire buffers.

Update the bufferpool size only if video_info defines an actual buffer
size.
2023-10-27 18:01:37 +02:00
Michael Tretter
bd15e5275b pipewiresink: copy metadata into pipewirepool buffers
If the pipewiresink needs to copy the GStreamer buffers to the PipeWire
buffers, because the upstream element didn't use the pipewirepool, the
metadata must be copied, too. Otherwise the pipewire datas will be
filled with the metadata from the buffer during the initialization and
not the currently used buffer.

For example, without copying the metadata the buffer timestamp will be
missing on the pipewire buffers.
2023-10-27 18:00:51 +02:00
Michael Tretter
9a72766ae8 pipewiresink: fix type of SPA_META
The SPA_PARAM_META_type must be configured as a SPA_POD_Id, not as
SPA_POD_Int. Otherwise, PipeWire won't allocate the metas.
2023-10-27 17:44:32 +02:00
Michael Tretter
109567ed3d conf: fix videotestsrc example configuration
In JSON, the colon actually is used for assignment, but in spa_type_info
the colon is used as a separator. To properly parse and pass the
properties to the videotestsrc, the key has to be enclosed by quotation
marks to prevent splitting by the JSON parser.
2023-10-26 16:35:30 +02:00
Michael Tretter
63865307d9 conf: set description for test nodes
Commit 9b29bcd4e8 ("conf: set description for test nodes") set the
description only for the minimal.conf and pipewire.conf and skipped the
pipewire-vulkan.conf.

Set the description for pipewire-vulkan.conf, too.
2023-10-26 16:33:49 +02:00
Michael Tretter
e3fb4301eb videotestsrc: implement impl_node_set_io to fix segfault while loading
In pw_context_recalc_graph, PipeWire takes the currently configured
clock target duration from the position as target rate. The position is
not set for the videotestsrc since the set_io function is not
implemented. This leads to a segfault when the videotestsrc is
configured and loaded.

Add the same dummy implementation of set_io as in the v4l2-source and
the libcamera-source to prevent the segfault.
2023-10-26 15:54:10 +02:00
Pauli Virtanen
b7e863b8cf bluez5: fix logic error in device set leader selection
Fix device set node sometimes not being emitted.

When leader changed it marked no-one as leader, do that in less buggy
way.
2023-10-24 19:45:03 +03:00
Pauli Virtanen
d121d273f0 bluez5: add more debug for device sets 2023-10-24 19:40:44 +03:00
Wim Taymans
733cf7835e jack: add jack_set_sample_rate() extension 2023-10-24 11:08:49 +02: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
963ea1f57c tools: make pw-dump/mon/top try to connect to the default manager socket
These tools are used for debugging, and should default to connecting to
the manager socket if present.
2023-10-24 07:08:07 +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
920beea3eb alsa: guard agaist NULL areas
snd_pcm_ioplug_mmap_areas() can fail and return NULL

Fixes #3600
2023-10-22 17:27:27 +02:00
t123yh
7fa64a8b71 example: fix invalid free() operation in bluez-session
obj->handle should not be directly freed; instead, it should be
freed using "pw_unload_spa_handle", otherwise there will be
segmentation fault.
2023-10-22 14:48:44 +00:00
t123yh
8848923d82 examples: add props to bluez-session to prevent quirk parse error
In bluez5-dbus.c:impl_init, the info is passed to spa_bt_quirks_create,
which expects info to be non-null. But in this example, info is null, so
it will cause quirk table parse failure. Add an empty dict here to prevent
this error.
2023-10-22 14:48:44 +00:00
Wim Taymans
69134f8d3e filter-chain: add linear operation to dsp 2023-10-22 10:50:03 +02:00