Commit graph

6195 commits

Author SHA1 Message Date
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
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
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
Wim Taymans
1b09c4a2cc filter-chain: add more math functions
Add clamp, recip, exp, log
2023-10-22 09:41:05 +02:00
Wim Taymans
3eed0fbe9b gst: mark streams async
From the process callback we signal a cond and don't dequeue/queue
a buffer directly.
2023-10-21 09:42:15 +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
Wim Taymans
80afa3a296 impl-link: fix log 2023-10-20 16:18:41 +02:00
Wim Taymans
81437f7a77 impl-link: refactor function to update busy_count
This also makes sure the busy_count of a previous busy_id is undone when
setting a new id.

Also logs an error when the busy count goes negative.
2023-10-20 15:11:46 +02:00
Wim Taymans
5a93d77acf impl-link: ensure busy_count and busy_id stay in sync
We can only increment or decrement the busy_count with a valid busy_id.

In complete_ready and complete_paused, the id can be INVALID and if
there was no pending busy_id, it would decrement the busy_count below 0.

This would block the link from progressing its state change.

See #3547
2023-10-20 12:26:41 +02:00
Wim Taymans
3d8c7c40b5 stream: improve queued_buffers reporting
Also add the queued buffers in the converter to the pw_time.queued_buffers
field. This means that queued_buffers + avail_buffers always equal the
total amount of allocated buffers, which makes more sense.

Fixes #3592
2023-10-20 09:57:52 +02:00
Wim Taymans
cb26ea2dfa conf: add missing =
Fixes #3589
2023-10-20 07:52:21 +02:00
Wim Taymans
42418bece5 impl: destroy node and device in global free
Destroy the node and device in the global free event. This way, the
global resources are already destroyed and we have removed their ref to
the spa node before we destroy that.

Fixes #3588
2023-10-18 18:51:48 +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
19b02003b0 context: relax quantum change conditions
We can change the quantum of a node while it is running just fine so
relax the check.

This was copied from the rate change logic, which is avoided while the
node is running.

This fixes a regression in dynamic quantum switching.

Fixes #3574
2023-10-16 16:29:01 +02:00
Wim Taymans
7d5b809b19 jack: make option to make input writable 2023-10-16 11:40:03 +02: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
Wim Taymans
8f2ee0a29c Revert "jack: use a private writable mapping on input"
This reverts commit 6fefd49a8a.

We can't use PRIVATE because mmap docs say that we then might not see
changes in the data anymore from other processes.

Fixes #3575
2023-10-16 09:36:16 +02:00
Wim Taymans
6fefd49a8a jack: use a private writable mapping on input
See #3571
2023-10-14 12:23:39 +02:00
Wim Taymans
11320cf203 tweak number of buffers
In most cases we can use just 1 buffer.

The alsa-pcm-source needs at least 2 buffers so increment the min
limit.
2023-10-13 14:00:29 +02:00
Wim Taymans
8e95f1a575 module-ffado: remove hardcoded quantum_limit 2023-10-13 13:46:20 +02:00
Wim Taymans
4bb3e292c5 netjack2: remove hardcoded buffer size 2023-10-13 13:40:22 +02:00
Wim Taymans
01857b616c filter-chain: remove some hardcoded limits
Use the quantum_limit instead of a hardcoded value.
2023-10-13 13:32:12 +02:00
Wim Taymans
ac51fbfd1e buffer: remove some hardcoded buffer size limits
Use the quantum_limit as the max buffer size instead of the hardcoded
8192 value.
2023-10-13 13:07:48 +02:00
Sebastian Jaeckel
75fcbf1e6c aes67: add clock.interface example and update the documentation comment 2023-10-12 17:32:50 +00:00
Wim Taymans
ffa6a4083a conf: add new alsa option 2023-10-12 18:45:12 +02:00
Pauli Virtanen
bb120a070f pipewire: add PW_KEY_SEC_SOCKET and set it in protocol
Add client key PW_KEY_SEC_SOCKET that indicates which socket the client used
to connect to the server.

This can be used by other modules as an access control mechanism.
2023-10-11 19:08:18 +03:00
Pauli Virtanen
72462ebd07 module-protocol-native: add module argument 'sockets'
Add module argument 'sockets' for creating multiple sockets clients can
connect to.

Also allow setting socket file permissions.
2023-10-11 19:08:18 +03:00
Wim Taymans
6d0613bc9a pulse-server: place stream media.* keys as Tag 2023-10-11 15:17:13 +02:00
Wim Taymans
b3f8df6dfc pw-cat: don't overrun our param array 2023-10-11 13:34:18 +02:00
Wim Taymans
e90bf4701c filter-chain: fix typo 2023-10-11 09:39:06 +02:00
Wim Taymans
fcde479a82 env: PIPEWIRE_QUANTUM now uses FORCE_RATE and FORCE_QUANTUM
Make it force a RATE and QUANTUM on the graph. The non-force options
can already be done with PIPEWIRE_RATE and PIPEWIRE_LATENCY.
2023-10-10 15:10:19 +02:00
Wim Taymans
6c32b50ccd filter-chain: explain volumes a little better 2023-10-10 15:04:47 +02:00
Wim Taymans
4b940100b1 impl-node: rework resume after rate switch
We only need to resume the SUSPENDED node when it has !pause-on-idle.
So, set the need_resume flag when we suspend in that case.

Clear the flag in the next round and make sure we set the node to
running again. We don't need to clear any flags when the state change
completes anymore with this change.

This also fixes a case where strawberry would fail to configure the
correct sample rate. 44.1KHz would be used (the rate of the probe
stream) because the scheduler was thinking the node was still being
reconfigured because the reconfigure flag was only cleared when going
to the running state (an alsa sink has !pause_on_idle).

See #2929
2023-10-09 17:46:38 +02:00
Wim Taymans
acbe75d9a1 rtp-stream: senum -> seqnum 2023-10-09 11:12:21 +02:00