Commit graph

2818 commits

Author SHA1 Message Date
Wim Taymans
3c38794886 pulse-tunnel: recover from xruns better 2022-03-30 17:59:25 +02:00
Wim Taymans
da6687e6ec module-pulse-tunnel: use dll to keep latency under control
Assign half the latency to the internal ringbuffer and half on the
network and remote end.
Use a dll to calculate the drift from our target ringbuffer fill
level and use the stream rate property to driver the resampler.

This should reduce uncontrolled latency over the tunnel.

PulseAudio wants us to be a driver will pull requests from the remote
side. We would need to provide a clock based on the remote end and
also try to follow it when we are not a driver. It would be slightly
better because in the normal playback case we would be able to
avoid resampling. We might do this eventually.
2022-03-30 17:23:09 +02:00
Wim Taymans
4ae94a6ca6 modules: use NODE_WANT_DRIVER=true instead of NODE_GROUP
For the modules that require a driver, don't add ourselves to
the pipewire.dummy group but instead just use the NODE_WANT_DRIVER
property to be assigned to a driver.

This makes it possible for the nodes to move to another driver than the
dummy driver (which has very high priority) and it avoids resampling in
cases where the nodes are linked to an audio source or sink.
2022-03-30 14:56:28 +02:00
Wim Taymans
8ec3932e97 pulse-server: include buffered data in stream delay
The buffered data includes the extra samples used by the resampler.
2022-03-29 17:41:14 +02:00
Wim Taymans
5a9d2679ca stream: add pw_stream_get_time_n()
Deprecate pw_stream_get_time() in favour of _get_time_n() that contains
the size of the pw_time structure. Make the old one fill in the fields
up to the buffered field. Make the new one use the size to decide how
much info to fill in.

Add a new buffered field in pw_time that contains the buffered data
inside the converter/resampler. This leaves the queued field with
purely the user provided size in the buffers.

Use get_time_n() in places.
2022-03-29 17:30:38 +02:00
Wim Taymans
7e42c905a8 remove the rate_match io
Now that the stream provides us with a requested size, we don't need to
use the rate_match anymore.
2022-03-29 09:57:49 +02:00
Wim Taymans
74da804e97 move some debug to fastpath 2022-03-28 16:25:00 +02:00
Joakim Olsson
90eec9320a module-echo-cancel: Use fraction as play delay
Change from ms to fraction for play delay to increase precision in delay
2022-03-23 07:55:39 +01:00
Joakim Olsson
d161019b0d module-echo-cancel: Correct naming in example and plugins 2022-03-21 09:54:20 +00:00
Wim Taymans
2b16df4e89 spa: add locale independent spa_dtoa
And use this in spa_json_format_float() where we also avoid invalid
json floats.
Use json float format in some places where we serialize json floats.
Add a unit test.

See #2223
2022-03-21 10:41:44 +01:00
Barnabás Pőcze
186d0a783e pulse-server: module: only cancel unload work if added
Only try to cancel the unload work in the work queue
if one has actually been added.
2022-03-17 21:31:02 +01:00
Barnabás Pőcze
f4fd884b15 pulse-server: manager: clean hook list
Clean the manager's hook list when it is destroyed.
2022-03-17 21:11:59 +01:00
Barnabás Pőcze
05a99c0e15 pulse-server: sample-play: clean hook list
Clean the hook list when the object is destroyed.
2022-03-17 21:11:59 +01:00
Barnabás Pőcze
807fa19319 pulse-server: module-combine-sink: remove unnecessary conditional
After dequeueing the buffer, the code immediately checks if it is NULL,
and never modifies the variable. Therefore there is no need to check
again when the buffer is enqueued.
2022-03-17 21:11:59 +01:00
Barnabás Pőcze
d71dd31dcf pulse-server: module: initialize index
Initialize the index to `SPA_ID_INVALID` when a
module object is created. This way `module_free()`
may be called right after `module_new()`.
2022-03-17 19:35:48 +01:00
Théo Lebrun
344cacd24a module-rt: small fixes
Signed-off-by: Théo Lebrun <theo.lebrun@bootlin.com>
2022-03-11 18:47:25 +00:00
Théo Lebrun
6798b9a933 module-rt: allow building without RTKit 2022-03-11 18:47:25 +00:00
Wim Taymans
f06ee28140 pulse-server: add sink/source_properties
Support setting extra properties on the sink and source with the
sink/source_properties.
Fix construction of the module arguments, the sink/source.props needs to
be inside the object..

Fixes  #2201
2022-03-11 09:57:37 +01:00
Barnabás Pőcze
8fa4d5c43f pipewire: module-zeroconf-discover: handle when AvahiWatch is freed while dispatching
When a particular AvahiWatch is being dispatched, it cannot
be freed because `watch_callback()` accesses it after
the callback.

Introduce a member (`dispatching`) to coordinate
the deferred freeing in that case.

The timeouts are not affected because the `AvahiTimeout`
object is not accessed after the callback is called.
2022-03-10 21:44:27 +01:00
Wim Taymans
dcbaed1251 pulse-server: also handle fix_ for capture 2022-03-07 10:26:59 +01:00
Wim Taymans
2653e9f129 filter-chain: use property hints
Use property hints to expose int or bool controls.
2022-03-03 21:23:25 +01:00
Wim Taymans
2125ec048d filter-chain: use dynamic builder for param update 2022-03-03 21:22:23 +01:00
Wim Taymans
5a55e1a47a pulse-server: handle pulse.properties
Load properties from pulse.properties section so that they can have
overrides.
2022-03-03 11:59:55 +01:00
Wim Taymans
b645793d7e filter-chain: remove stray debug 2022-03-02 21:43:37 +01:00
Wim Taymans
99f9f729ff handle open_memstream errors
Fixes #2182
2022-03-02 11:48:31 +01:00
Wim Taymans
fdaf4613d8 module-raop: handle and debug read errors
Fixes #2183
2022-03-02 11:28:43 +01:00
Wim Taymans
00d4de3799 module-raop: use the right socket to read from
See #2183
2022-03-02 11:24:40 +01:00
Wim Taymans
e7958fac1b filter-chain: remove limits on ports
Allocate all ports dynamically so that there is no limit anymore.

Fixes #2179
2022-03-02 10:12:22 +01:00
Wim Taymans
c89595d86f protocol: increase some limits 2022-03-02 10:05:27 +01:00
Wim Taymans
b324c02570 filter-chain: use offsets to deref pods
In a dynamic builder we can only save the offsets in the array and
deref after we completed building everything.

Increase the control limits.

See #2179
2022-03-01 21:24:39 +01:00
Wim Taymans
cdf1b15d38 client-node: use dynamic pod builder 2022-03-01 21:07:56 +01:00
Wim Taymans
d3a1b9fe31 spa: add dynamic builder helper
Resizes the buffer dynamically. Be careful with getting the address
of a pod in the buffer, it might not be valid after building more stuff
with the builder.
2022-03-01 20:32:58 +01:00
Wim Taymans
168511c157 filter-chain: do some checks on the number of ports
Try to check that we don't overflow our port arrays.
2022-02-28 20:44:05 +01:00
Wim Taymans
5c44c6cd5c filter-chain: use MAX_CONTROLS for control ports
See #2179
2022-02-28 20:32:35 +01:00
Pauli Virtanen
fb04074335 pulse-server: set also metadata target.object when moving streams
Set also metadata target.object when moving streams, in case the session
manager supports that.
2022-02-28 18:36:26 +00:00
Pauli Virtanen
ab353a8057 module-session-manager: set object.serial on session objects
Session, endpoint, link, and stream objects should also set
object.serial.
2022-02-28 20:11:01 +02:00
Pauli Virtanen
3b94345bbe module-metadata: set object.serial on new client metadata
Client-created metadata should also set object.serial.
2022-02-28 20:11:01 +02:00
Pauli Virtanen
d71cf24183 global: update generation number also in clients without registry
Not all clients have an existing registry, and the registry generation
number will not be updated for them.  However, we would like to check
for stale globals also elsewhere, eg.  metadata, and it must work also
in this case.

To avoid failing to update client registry generation, on global
addition which the client would see if it had a registry, send done
message for the new global id instead.
2022-02-27 15:04:23 +02:00
Pauli Virtanen
a9accd1668 protocol-native: footer pre_demarshal must come first
Message footer should be handled before attempting to find the object
the main message is sent to / checking permissions, because it is not
aimed at a specific object.  E.g. the registry generation updates should
be handled regardless of whether the main message is valid or not,
because the updates will not be re-sent.

Fixes registry generation updates sometimes going missing.
2022-02-26 17:48:51 +00:00
Wim Taymans
76aaae2034 pulse-server: get stream id in paused
We can get the stream id when going to PAUSED.
2022-02-24 13:08:50 +01:00
Wim Taymans
6769becac5 module-echo-cancel: fix leak on error
Don't leak the properties on error.
Use and log the error returned from the init function.
2022-02-22 17:27:33 +01:00
Wim Taymans
2cd3427786 pulse-server: fix device.description
We now translate device.description to node.description when parsing
the properties so check for node.description and generate one when
it's not available.

Fixes #2166
2022-02-22 15:27:06 +01:00
Wim Taymans
580f499939 filter-chain: improve error reporting
Don't overwrite the errno from the plugin loader with 0 so that we can
actually report the right error.
2022-02-22 12:42:36 +01:00
Wim Taymans
62ae9b7d30 filter-chain: avoid denormals in biquad
See #1681 #2160
2022-02-21 17:34:52 +01:00
Wim Taymans
edb5664017 pulse-server: fix IEC958 passthrough again
We need to create fake channels when parsing the IEC958 format or
else we get an invalid format and IEC958 passthrough doesn't work.

Ignore the IEC958 formats when collecting formats for the device or else
the fake channels mess with the real channels of the device.

See #1442
2022-02-21 16:53:03 +01:00
Wim Taymans
22ec01d5c0 pulse-server: improve fix_ flags handling
PulseAudio will convert the samplespec/channelmap to a format_info
and omits the input format/rate/channels when the fix flags are set. It
does not use the input values at all.

Do the same in pipewire-pulse, make a single format description without
the requested fields.

This also needs a session manager fix to make it deal with those missing
fields.

See #876
2022-02-21 15:19:08 +01:00
Wim Taymans
e420b9c93c pulse-server: place the final sample rate as property
Use the final negotiated sample rate as node.rate to suggest a rate for
the graph.
2022-02-21 14:54:21 +01:00
Wim Taymans
d6a2b21fbe pulse-server: don't deref freed pending_sample 2022-02-21 11:12:10 +01:00
Wim Taymans
0475adbd35 pulse-server: wait for pending_sample to complete
Wait the reply to be sent and the sample to complete playback before
freeing the sample. Otherwise it might have been possible that the
sample completes before the reply can be sent.
2022-02-21 08:57:15 +01:00
Wim Taymans
1d9be5b25a pulse-server: ref client while completing operations
So that an operation can't accidentally free the client.
2022-02-21 08:56:02 +01:00