Commit graph

2370 commits

Author SHA1 Message Date
Wim Taymans
37439d2b73 pulse-server: add gsettings module
Uses a thread to monitor gsettings data. Loads and unload modules
based on gsettings.

This makes paprefs work.
2022-12-07 09:45:43 +01:00
Wim Taymans
89d4cafec4 pulse-server: fix module args 2022-12-06 19:02:02 +01:00
Wim Taymans
865d41b986 pulse-server: module does not depend on client
We don't need to pass the client to the module create and load
functions, they can work without a client.

The only place the client is used is to access the properties to make a
new connection to pipewire. This is also however not a good idea, we
should simply use the defaults used by the context or else a client
could set strange properties like remote.name etc for these internal
connections.

Also removing the dependency of the client will make it possible to load
modules from the startup script or other modules later.
2022-12-06 18:26:29 +01:00
Wim Taymans
9f2abea480 module-loopback: deactive both streams before destroying
First deactivate both streams so that they are not calling eachother
anymore and then destroy the streams.
2022-12-05 16:05:37 +01:00
Wim Taymans
a20101c58c pulse-server: Add IPv4 address first in server list
So that zeroconf-discover prefers to publish with the IPv4 address
because that is likely more successfull.

See #2861
2022-12-01 20:17:08 +01:00
Barnabás Pőcze
c933c5ed74 pipewire: module-zeroconf-publish: only unpublish service when necessary
When a server is stopped, only unpublish those services
that have been published with that particular server,
do not touch the others.
2022-11-28 14:54:04 +01:00
Wim Taymans
5f000b007d filter-chain: optimize copy plugin
A copy plugin at the input ports can be replaced by directly writing
into the peer input ports so that we can avoid a memcpy.
2022-11-27 11:56:00 +01:00
Wim Taymans
f673764e58 filter-chain: use optimized sum 2022-11-27 11:55:55 +01:00
Wim Taymans
ca8bc59d0a filter-chain: add biquad to dsp functions 2022-11-24 19:14:34 +01:00
Wim Taymans
be1d4940a3 protocol-native: initialize fields
Set some of the fields to default values.

Fixes #2852
2022-11-24 09:40:14 +01:00
Wim Taymans
0f79014e18 filter-chain: add some optimized mix functions 2022-11-22 17:59:44 +01:00
Wim Taymans
9d8edef1a0 client-node: guard against NULL resource
When destroying, the resource can be NULL (mix->io should also be
NULL ideally so we can check first).

See #2847
2022-11-21 20:20:16 +01:00
Barnabás Pőcze
67e77d13f6 client-node: set port data before calling _set_mix()
First set some of the port flags and data, especially the owner_data
before calling pw_impl_port_set_mix(), which will use the owner_data
to send the mix_info.

See #2847
2022-11-21 20:15:39 +01:00
Wim Taymans
0918899bf8 client-node: send the mix_info before Buffer IO
We don't always need to send buffers to a remote port, when the port
is an output port, all the mix ports use the same buffers. This means
that when we add another link to a port, we don't get the mix_info
anymore and then we don't know the peer_id and we don't complete the
link and we don't call the connection_callback.

Instead, send the mix_info right before sending the Buffer Io area. We
always do this for all mix io and after we have sent the buffers so this
is a better place.

Fixes #2841
2022-11-20 19:24:01 +01:00
Wim Taymans
a0adb52124 pulse-server: add a pulse.idle.timeout option
When a client is not sending any data when it should be and causes an
underrun, mark it as idle and record the timestamp.

When a client is idle for pulse.idle.timeout seconds, set the stream
as inactive. When more data is received, set it back to active.

Add a pulse.idle.timeout option to set a global server default or
a per-stream value. Set the server default to 5 seconds. A value of 0
can be used to disable this feature.

With this change, badly behaving clients that are not sending any data
will be paused so that the sinks can suspend to save battery power.

Fixes #2839
2022-11-20 16:20:05 +01:00
Wim Taymans
b1c0662a00 pipewire-pulse: improve parsing of defaults
When we fail to parse a fraction from the config, give a warning and
continue with the default settings.
Print the final parsed value as debug.
2022-11-20 16:19:24 +01:00
Wim Taymans
fc159be9c6 pulse-server: make method to pause/resume stream
Make a method to pause and resume a stream and keep track of the paused
state of the stream. Use this function instead of setting the stream
inactive/active so that we get nice logging for each state change.
2022-11-20 16:19:24 +01:00
Wim Taymans
72912c9589 pulse-tunnel: improve latency property docs
To make it clear it needs to a number only (without ms at the end)
2022-11-17 19:04:46 +01:00
Wim Taymans
3085e312b6 pulse-server: handle server started and stopped events
When a server is started, try to publish the pending services.
When a server is stopped, republish the services.

This makes it possible to load and unload the tcp protocol after loading
the zeroconf publish module and it will do the right thing.
2022-11-17 18:36:47 +01:00
Wim Taymans
a11612bdad pulse-server: add event to the implementation
Add events when a server is started and stopped
2022-11-17 18:31:23 +01:00
Wim Taymans
ab5fe8957b pulse-server: use running servers to publish zeroconf
Loop over the servers and use its family and port to publish the
zeroconf services.

This avoids exposing the services when we don't have any TCP servers
running to accept connections.

It also avoids exposing the services twice with both IP4 and IP6
addresses.

It also exposes the services with a port that is actually usable, in
case it's not the same as the default port.
2022-11-17 17:07:38 +01:00
Wim Taymans
945529f029 modules: actually copy the network property to the stream
Fixes #2384
2022-11-17 15:56:39 +01:00
Gleb Popov
525e7aa734 FreeBSD build fixes. 2022-11-14 21:03:22 +03:00
Gleb Popov
018058ea35 Fix copy-paste typo in the warning message. 2022-11-14 20:58:14 +03:00
Gleb Popov
781b7b187a Add a type cast necessary to compile on FreeBSD. 2022-11-14 19:57:08 +03:00
Wim Taymans
b720da771e pulse-server: also advance read pointer in underrun
So that we ask for more data from the client.

Also retested with #2799 that caused this regression.

Fixes #2821
2022-11-10 16:13:33 +01:00
Julian Bouzas
bc2a02c283 echo-cancel: add option to make echo-cancel sink node a monitor
The monitor mode does not create a echo-cancel-playback node, and makes the
echo-cancel-sink node to be a monitor node with media class Stream/Input/Audio
(instead of Audio/Sink).

Some applications get confused when their output stream node is not linked
directly to the actual device node. Having echo-cancel-sink as a monitor node
avoids this problem, allowing those applications to work properly even if echo
cancel is enabled.

This mode is disabled by default. You can enable it by passing the specific
option  (monitor.mode = true) in the args when loading the module in the
pipewire context.modules configuration section.
2022-11-07 17:21:21 +00:00
Wim Taymans
44d743ed95 spa: make all format parsing fields optional
Just like the optional build, make all field parsing optional. This
will leave the fields with their default values if they are not parsed
from the param.

We can then remove our custom functions and use the generic ones in
various places.
2022-11-03 13:13:07 +01:00
Wim Taymans
74447acedb Add some more format checks
The format parse functions don't really check if the parsed values
make any sense so we need to to this ourselves.
2022-11-03 13:10:32 +01:00
Wim Taymans
3e4da8e8e4 filter-chain: emit en error when graph fails 2022-11-02 12:58:37 +01:00
Wim Taymans
f6e76f8356 filter-chain: add more default LADSPA search paths
Add /usr/lib/ladspa and LIBDIR to the default search path as well.
2022-11-02 12:57:16 +01:00
Wim Taymans
ef8114ff0c filter-chain: improve some error messages 2022-11-02 12:42:31 +01:00
Wim Taymans
6bb73124aa filter-chain: improve some float handling
Avoid some double to float conversions.
Use fmin and fmax.
2022-11-02 12:41:20 +01:00
Wim Taymans
f801dc0886 pulse-server: keep read index in sync
Keep the ringbuffer and read_index variable in sync or else we might ask
for more data than maxlength and cause an overflow.

Fixes #2799
2022-11-02 11:43:30 +01:00
Ashok Sidipotu
f383956b7b module-pipe-tunnel: Update the description of the module. 2022-10-28 07:07:43 +00:00
Ashok Sidipotu
315b2d1ad5 module-pipe-tunnel: Initialize the target.node property
Initialize the PW_KEY_TARGET_OBJECT property on the stream node based on the
user config.
2022-10-28 07:07:43 +00:00
Wim Taymans
e6fd5888ee param: add a new user seq field in the param-info
Add a new seq field in the param-info struct. Users can use this
field to keep track of pending param updates.

Store the latest seq number of the param update in the seq field. Remove
all params that don't match the sequence number because they are too
old. This avoids duplicate old params in pw-dump output.

Rework the pulseaudio manager with this same method.
2022-10-27 20:10:33 +02:00
Wim Taymans
d2aa240767 introspect: handle NULL result from info updates 2022-10-27 20:06:54 +02:00
Wim Taymans
f0328a1f8d protocol-native: improve logging
Add an end marker in the log for the message.
Log the output messages with the right log topic.
2022-10-27 18:04:14 +02:00
Christoffer Gydenius
b35983eb7e module-echo-cancel: aec-plugin parameters
Make it possible for a aec-plugin to provide props/params
through module-echo-cancel and make it possible for a
aec-plugin to listen and react to these props/params getting updated.

Add method enum_props() that is used under setup_streams() to
get props from aec_plugin.
Add get_params() and set_params() for updating and getting
aec-plugin params under the input/output_param_changed calls
and getting params under setup_streams().
2022-10-24 16:58:00 +02:00
Jonas Holmberg
facf73b01c module-echo-cancel: Correct offset
Correct the offset of first delayed data to run the canceller on.
2022-10-21 16:25:57 +00:00
Jonas Holmberg
8092a0a637 module-echo-cancel: Run canceller on first frames
Run canceller on the first frames when play delay is not a multiple of
the chunk size.
2022-10-21 14:53:26 +02:00
Jonas Holmberg
0e066e44fe module-echo-cancel: Don't use old delayed play data
Do not use old delayed data in play_buffer when a new stream is started.
Copy silence to output until play_buffer has been filled with new data
instead.
2022-10-21 11:42:41 +02:00
Wim Taymans
24b113e2d3 module-loopback: add target.delay.sec property
Add a target.delay.sec property to module-loopback that uses a
ringbuffer to further delay the signal to the requested value. This
also takes into account the graph delay to get an end-to-end delay.

Add a -d property to pw-loopback to control this.

Implement latency_msec on the pulse module with this new property so
that it behaves similar to pulseaudio.
2022-10-20 16:02:28 +02:00
Wim Taymans
35c9650e0e pulse-server: do chmod of the socket like pulseaudio
Pulseaudio sets the socket permissions to 0777 with chmod when the
socket was not from systemd. Do the same.

Fixes #1729
2022-10-20 11:49:52 +02:00
Wim Taymans
e5881e9afb module-pulse-tunnel: rate limit some messages 2022-10-20 09:24:54 +02:00
Wim Taymans
88785c42e5 modules: avoid partial writes to pulseaudio
Pulseaudio requires that we call pa_stream_write with a multiple
of frame_size bytes. Because our ringbuffer is a power of two, this
might cause problems at the edge of ringbuffer where a sample is
split between the end and beginning of the ringbuffer.

Avoid this by letting pulse allocate a buffer instead and memcpy
the requires samples into it.

Fixes multichannel output on module-pulse-tunnel.
2022-10-18 13:14:32 +02:00
Wim Taymans
e6356f7415 module: pass a channel map in pa_stream_new
Convert the PipeWire channelmap to pulseaudio and pass it in
pw_stream_new().
2022-10-17 18:58:15 +02:00
Wim Taymans
e2638b4b68 modules: use resample.prefill for echo cancel streams 2022-10-17 15:09:46 +02:00
Wim Taymans
3e9b4657cb modules: add since tag 2022-10-13 13:16:33 +02:00