Commit graph

8846 commits

Author SHA1 Message Date
Wim Taymans
66e4334c92 channelmix: reuse more functions
Make some copy/vol functions and reuse them.
Reuse the 2->3p1 upmix code, tweak it a little to that the widen
param is always used.
2022-04-12 11:54:27 +02:00
Wim Taymans
e12e4295cf channelmix: only filter FC and LFE when upmixed
When we have an original source with LFE and FC, don't try to mix
it but pass it unmodified.

Fixes #2280
2022-04-12 11:51:01 +02:00
Wim Taymans
b97327e1f6 module: handle type register errors
Registering an export type can give an error when the type is already
registered. Handle those errors and refuse to load the module.

See #2281
2022-04-11 21:15:13 +02:00
Barnabás Pőcze
37fa911a72 pulse-server: module: rework registry
Move all module methods into the `module_info` struct, and place
all such structs into the "pw_mod_pulse_modules" section of
the executable. This way there is no need for an explicit
module registry, and all information about a module can
be declared in the module's source file in a single place.
2022-04-11 03:02:08 +02:00
Wim Taymans
6ad6300ec6 pw-reserver: add a -r option to RequestRelease
When we try to acquire a Device and things are busy, try to
RequestRelease the device if the -r option is given.
2022-04-08 12:12:58 +02:00
Wim Taymans
1547e5fd2b alsa: limit the buffer-size to quantum-limit * 4
We don't actually need to allocate the largest possible buffer. A buffer
that is near 4 times the quantum-limit is more than enough.

See #1995
2022-04-07 16:01:48 +02:00
Wim Taymans
0c97008291 impl-node: improve node_set_active for exported nodes
Exported nodes (streams, filter) are not registered in the local
context and notify the server when they change active state.

When the node becomes inactive, this triggers a message to the server to
make the node inactive, which then eventually results in a PAUSE request
on the node, which then removes the node from the processing loop.

Unfortunately, clients expect that after a node is set inactive, the
process function will not be called anymore and they might free any
resources immediately. Handle this by removing the node from the
data-loop and waiting for completion.

This should fix some crashes when streams are stopped.
2022-04-06 13:03:30 +02:00
columbarius
7155913553 Revert "spa: set _GNU_SOURCE"
This reverts commit a2e98e28c1.
2022-04-05 17:13:18 +00:00
columbarius
f36f673b3b spa: replace locale aware string functions with uselocale
Not all string functions have a POSIX compliant locale aware version
(eg. strtof_l). Instead uselocale [1] should be used, which allows
switching the locale of a thread to a welldefined one and restoring it
afterwards.

[1] https://man7.org/linux/man-pages/man3/uselocale.3.html
2022-04-05 17:13:18 +00:00
Wim Taymans
54f6f9293e channelmix: upmix disabled also disables FC and LFE generation
Don't generate FC and LFE when upmix is disabled.

Fixes #2266
2022-04-04 09:08:54 +02:00
muzena
64a09a73dc Update Croatian translation and pipewire.pot 2022-04-03 13:02:21 +02:00
Wim Taymans
5b01a2e738 jack: fix port sort
When the nodes are equal, sort playback ports befor monitor ports.
Then sort by system-id (port-id) and then by serial number.

See #2260
2022-04-02 09:42:22 +02:00
ErikMN
a2e98e28c1 spa: set _GNU_SOURCE
Set CFLAG _GNU_SOURCE in order to suppress warnings about implicit
declaration from strtof_l and strtod_l.
2022-04-02 09:32:40 +02:00
Wim Taymans
ecc9bc2524 man: add pw-link manpage
Fixes #2263
2022-04-02 09:16:13 +02:00
Wim Taymans
d19650178f docs: fix pw_deinit() docs
See #2238
2022-04-01 19:09:56 +02:00
Wim Taymans
617405e08c jack: don't sort ports on alias
The alias is not a good property to sort on, it contains the object
path and could sort playback_11 before playback_2.

Just group ports of the same node together, then sort by port_id and if
that fails, use the serial number.

See #2260
2022-04-01 17:29:39 +02:00
Wim Taymans
cc39644253 modules: add pid to unique name
So that modules loaded from different processes don't generate the
same node names.
2022-04-01 15:22:48 +02:00
Wim Taymans
2922b0e108 channelmix: make PSD the default again
We can't have a default that simply copies channels, that's just
wrong. So we enable PSD again.

PSD does a good job of moving the ambient sound to the back. It's
subtle and almost stereo like but it's better than plain stereo.

The stereo widen has been reduced to make it more like the simple
upmixing.

People that previously wanted the copy-channels-experience had to
manually enable this in pulseaudio so it's not too much to ask
to manually switch the algoritm to simple. I think this is a better
default.

Fixes #861
See #2219
2022-04-01 11:50:57 +02:00
Wim Taymans
f9e8e689d3 filter-chain: free descriptor
Fixes #2220
2022-04-01 10:10:22 +02:00
Wim Taymans
da10a2ad60 context: destroy data-loop in free
Just stop the data-loop before destroying the modules because they might
still try to access it.
Destroy the data-loop in the free phase instead.

Fixes a valgrind error where module-rt tries to clear the thread-utils,
which causes the context to try to clear the thread-utils on the already
freed data-loop.
2022-04-01 09:58:46 +02:00
Wim Taymans
4a5129bdb4 fix stream test 2022-03-31 10:38:51 +02:00
Wim Taymans
5d31ec74ac stream: report queued and dequeued buffers in pw_time 2022-03-31 10:19:05 +02:00
Wim Taymans
0503ced8ab pw-cat: set buffer size field in frames
So that we get a meaningful value for the pw_time.queued field.
2022-03-31 10:16:15 +02:00
Wim Taymans
5ec7a9f40c pw-cat: start timer when playing 2022-03-31 10:15:57 +02:00
Wim Taymans
c6a8f8d3ef global: use SPA_ID_INVALID to send serial id
We use the done event to send the object serial to the client. Use an
invalid object id for this and filter it out on the receiver or else
the client might get an unexpected done event.

Fixes #2253
2022-03-31 09:39:49 +02:00
Carlos Rafael Giani
e8f93c3e1e meson: Add option to enable/disable legacy RTKit module
The RTKit module is being replaced by the RT module. Currently, it is
always built if D-Bus is present. For packagers, it can be beneficial to
be able to disable the legacy module. Add a Meson option to allow for
exactly that. Make it enabled by default to not change default behavior.
2022-03-31 07:07:40 +00:00
Wim Taymans
f0424c0b99 thread: deprecate pw_thread_utils_set()
Setting a global thread-utils is not a good idea, especially
when multiple contexts will register their own interface.

Instead, set the thread-utils as a context object and use this to
configure the data loop in the context.

In JACK we need a per context implementation of the interface so that
we can find the context specific thread-utils.

See #2252
2022-03-30 20:39:34 +02:00
Hugo Carvalho
f3466f8cd6 Update Portuguese(pt) translation 2022-03-30 16:59:15 +00:00
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
1bf1497855 spa: mode dll to utils 2022-03-30 17:22:26 +02:00
Wim Taymans
42d689edf2 stream: add support for double controls
We convert them to and from float.
2022-03-30 17:15:59 +02:00
Wim Taymans
7e227c5c6a fmtconvert: we support U16 format as well 2022-03-30 17:11:51 +02:00
Wim Taymans
2f5bba112f spa: Improve PropInfo fields
The PropInfo either has a registered id (and then also a name from the
type-info) or a custom name as a string.
In all cases, the description contains a free form text that clarifies
the property.

Use the description in the stream controls name.
2022-03-30 17:09:08 +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
01b4c4fa64 context: keep the driver passive when we can
Only make the driver node active when we assign it an always_process
node. Otherwise we can keep the driver passive until some other active
nodes are added.

Fixes a case where an need_driver node would automatically activate
the driver, even when nothing is to be scheduled.
2022-03-30 13:26:07 +02:00
Wim Taymans
5547f9a1b9 resample: take rate scale property into account as well 2022-03-29 17:51:03 +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
421b3b6ece filter: deprecate pw_filter_get_time()
The info is already in the io_position area that is passed to the
process function.
2022-03-29 17:28:11 +02:00
Wim Taymans
46d1328e1c pw-cat: improve output 2022-03-29 12:47:16 +02:00
Wim Taymans
1f2c4cc8dc stream: request quantum when no rate_match
If we have nothing to request, ask for a quantum worth of data.
2022-03-29 12:46:39 +02:00
Wim Taymans
5fc1ab90f7 stream: don't ask for 0 size buffer 2022-03-29 12:04:06 +02:00
Wim Taymans
6041d939a0 jack: make a custom thread-utils
Make a custom thread_utils that can use the configured global
thread creator and set this in the data-loop.

This ensure that the data loop uses the creator thread when activated.

See #1495
2022-03-29 11:37:47 +02:00
Wim Taymans
d306786012 jack: start/stop loop in activate/deactivate
Stop the loop from the context.
Start the loop in activate.
Stop the loop in deactivate.
2022-03-29 11:36:31 +02:00
Wim Taymans
2aa7283cc2 data-loop: always acquire rt priority
Always set the thread to rt priority when starting. We can then remove
the code to trigger this from the context.
2022-03-29 11:32:09 +02:00
Wim Taymans
2180b6aa17 data-loop: add method to set custom thread-utils
So that the thread creation can be switched for this data loop.
2022-03-29 10:49:37 +02:00
Wim Taymans
90d755ab4c thread-loop: we must be running to be in the thread 2022-03-29 10:48:11 +02:00
Wim Taymans
9849d12009 data-loop: check running state in _in_thread()
We can only be in the thread when the thread is running.
2022-03-29 10:47:44 +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