Commit graph

4095 commits

Author SHA1 Message Date
Wim Taymans 4b21e996c8 pulse-server: fix sample pactl command 2021-12-13 09:35:04 +01:00
Wim Taymans bcd867f8eb filter-chain: disable lilv code when not available 2021-12-10 18:46:06 +01:00
Wim Taymans 597b332666 filter-chain: add support for lv2 plugins
Support lv2 plugins and their control values.
2021-12-10 17:44:28 +01:00
Wim Taymans e1576c53d4 pulse-server: always ask for more data when underrun
Ask for more data when we are in underrun and not corked.

Fixes paplay and changing the quantum to something large.
2021-12-09 23:10:08 +01:00
Wim Taymans 7e5a0849f6 Revert "pulse-server: always asks for more data when underrun"
This reverts commit 1b94b66924.

It causes problems with qemu.

Without this patch, paplay --latency-msec=1 /some.wav hangs when
forcing the quantum to 8192. A different fix will be needed.
2021-12-09 16:54:47 +01:00
Wim Taymans 0d422f00dd module-echo-cancel: schedule source and playback last
Use the new TRIGGER flag on the stream to ensure that the source and
playback streams only get scheduled after we process their input
streams, the sink and capture.
2021-12-08 22:28:34 +01:00
Wim Taymans db77f6d37d stream: add TRIGGER stream flag
The trigger flag adds an extra dependency on the node so that it does
not automatically get scheduled. A manual scheduling is required with,
for example pw_stream_trigger_process().

This can be used to create an artificial dependency between a sink
stream and a source stream, like when using loopback or filter-chain.
Normally those streams are not linked in the graph but they have an
internal dependency. Without any such dependency, the source part of the
chain will be scheduled first and then the sink part and we get a
cycle of delay (with possible quantum change etc).

With this patch, the sink part will be scheduled first and its process
function will trigger the 'downstream' source stream explicitly. The
sink and source stream will stay in sync and will use the same quantum.
This reduces the latency and glitches because of quantum changes.

Fixes #1873
2021-12-08 20:29:15 +01:00
Wim Taymans 53dbfa79c3 settings: improve graph recalc reason 2021-12-08 20:28:27 +01:00
Wim Taymans 2e199eba43 node: update quantum and rate at beginning of cycle
Don't directly update the quantum and rate in the driver position
when recalculating the graph or else clients might see different values
during one cycle.

Instead update another variable and copy this into the position when
we start a new cycle.
2021-12-07 18:31:13 +01:00
Wim Taymans c14e89a578 impl-core: require WX flags to destroy an object 2021-12-07 17:13:18 +01:00
Wim Taymans a31bd26a42 impl-link: small cleanup 2021-12-07 15:33:01 +01:00
Wim Taymans fe417bd123 improve latency debug 2021-12-07 15:31:32 +01:00
Quantum 8bab9a18ec Add all 32-bit packed little endian 10-bit RGB colour formats
Given that 10-bit colour is now becoming supported on Wayland, PipeWire
should be able to represent all the possible colour formats in order
for screen capture to work.

This commit adds all possible orderings of 10-bit RGB channels and 2
extra bits used for nothing or alpha in little endian to enum
spa_video_format. Note that Wayland only uses little endian for its
10-bit colour formats, and these are not the same as the big endian
formats in reverse order.
2021-12-07 11:22:04 +00:00
Wim Taymans fbef731793 make some warnings into log
Move some warnings when a wakeup was missed to info messages. The
warning can repeat a lot and is otherwise quite useless and already
reported elsewhere.
2021-12-07 10:19:10 +01:00
Wim Taymans a8139b7acf pulse-server: handle prebuf state better
When we have a prebuf value, we start in the prebuf state.
We go back to prebuf when we have a prebuf value and an empty
ringbuffer.
2021-12-03 17:49:59 +01:00
Wim Taymans 16665d74d2 pulse-server: don't clamp missing bytes to tlength
When we increase the quantum past the tlength, we need to be able to
ask for more bytes than the tlength or else we will never exit this
underrun state. Look at the last required bytes and use that if it's
larger then tlength.
2021-12-03 16:43:16 +01:00
Wim Taymans 1b94b66924 pulse-server: always asks for more data when underrun
Even when prebuffer is active, we need to ask for more data to
resolve the underrun.
2021-12-03 16:41:41 +01:00
Wim Taymans 97cad7284a latency: fix latency combine calculations
0 is a valid min latency so we can't use it as an unset value. Use
some large value instead and when nothing was configured, assume it
is 0.

Fixes #1839
2021-12-02 14:49:48 +01:00
Wim Taymans ebd2af612a settings: use default rate as allowed rates as fallback 2021-12-02 11:35:13 +01:00
Wim Taymans fe547251da filter-chain: don't use id in PropInfo for params
One should use the name of the property in params to access the
property.
2021-12-02 11:35:12 +01:00
Wim Taymans f894a51eab protocol-native: keep reading messages after error
There is no reason to exit the message loop after receiveing an
error, we can just process the next message.
2021-11-30 12:25:33 +01:00
Wim Taymans c9264c9ce1 core: disable bind version checks
Allow clients to bind to different versions of the server object.

When the server object is newer, it will adapt to the older version.

If the server object is older and the client tries to call a newer
method, it will receive an error. The right thing for the client is to
then ignore this and not call the method again. It should also probably
first check the server version before calling newer methods.
2021-11-30 12:16:35 +01:00
Wim Taymans cc9fbe4375 pulse-server: add some debug 2021-11-30 09:22:58 +01:00
Wim Taymans 700a22b7f7 pulse-server: recover for underrun better
If we are underrun, don't update the read pointer and let the write
pointer catch up.
If we don't have enough data to fill a buffer, skip all the available
data and wait for the new request to arrive.

Fixes #1857
2021-11-29 20:22:05 +01:00
Wim Taymans 11b8a2aad4 buffer: handle the case where only MemPtr is selected
When we need to allocate buffers with shared memory but only MemPtr is
allowed, make sure we change this to MemFd.
2021-11-29 11:23:32 +01:00
Wim Taymans a0bf0e0686 buffers: improve fallback memory allocation
If one of the link ports is remote, enforce shared memory for the
buffer data. We must not use MemPtr because it will not be possible
to transfer this to the remote client.

If none of the sides selected any buffer type but we need shared
memory for the data, select MemFd as the fallback. This avoids using
DmaBuf, that the client did not explicitly select.
2021-11-29 11:07:13 +01:00
Wim Taymans cff8ac0cab client-node: improve memory checks
For MemPtr memory, we use the fd of the buffer metadata and chunk
info. Check that the memory is also in this block.
Check that all the memory of the buffer fits in the memory block.

See #1859
2021-11-29 10:42:02 +01:00
Wim Taymans d3cd36ab54 mem: improve debug
Print unsigned values as unsigned.
2021-11-29 10:41:30 +01:00
Wim Taymans 1b06d4d7c4 settings: Add more runtime settings
Move settings defaults initialization to the settings file.
Expose clock.rate, clock.allowed-rates and clock.quantum as runtime
settings.
2021-11-26 16:47:43 +01:00
Wim Taymans 6dab305407 protocol-simple: clamp size to maxsize 2021-11-25 10:24:09 +01:00
Wim Taymans a0d7fb01ba pulse-server: add size check when reading strings 2021-11-25 10:14:30 +01:00
Wim Taymans 5d20e3028a pulse-server: avoid reading past the message size
We can't really get into this situation but it is a good idea to check
that we don't try to read past the message length.
2021-11-25 09:48:34 +01:00
Wim Taymans ac4ec20b01 pulse-server: free pending client message
If the client is destroyed before it could completely read the message,
free the pending message as well.

See #1840
2021-11-23 18:13:35 +01:00
Wim Taymans 9feecb36d0 pulse-server: don't add large blocks to cache
See #1840
2021-11-23 17:44:01 +01:00
Wim Taymans 418c6fbe96 pulse-server: limit the max cache to 16MB
Don't recycle messages when we have too many allocated already.

See #1840
2021-11-23 17:24:24 +01:00
Wim Taymans e7f9046bb8 global: place object.serial in object info
Make a method to return or allocate the serial for a global.
When the global is unregistered, a new serial is calculated.
Place the serial in the object info and the global info.
2021-11-22 17:13:10 +01:00
Wim Taymans 53548aee75 global: add the object.serial property for globals
Make sure the lower 32 bits of the serial are never SPA_ID_INVALID. This
makes it possible for applications that need a unique 32 bits number to
use the lower bits while still having an invalid 32 bit serial number.
2021-11-22 16:30:00 +01:00
Wim Taymans 59c4975750 global: add serial number
Add a global serial number for each global object. We can use this
to uniquely define each global.
2021-11-22 16:00:25 +01:00
Wim Taymans 92a5570bbd raop: small cleanup 2021-11-22 10:53:49 +01:00
Wim Taymans 5ae75e1d2a pulse-server: use STREAM_CAPTURE_SINK for monitor capture
Make the pulseaudio layer set the PW_KEY_STREAM_CAPTURE_SINK property
when a monitor device is selected as a source to make it easier for the
session manager to find the right source.
2021-11-19 20:24:58 +01:00
Peter Hutterer d4d6458b5b modules: check for a NULL resource in client-device and client-node
See https://gitlab.freedesktop.org/pipewire/wireplumber/-/issues/113
2021-11-19 09:58:49 +10:00
Wim Taymans 5bc95234e8 filter-chain: fix memory leaks 2021-11-17 12:53:32 +01:00
Wim Taymans cf66400035 filter-chain: clean up on errors 2021-11-17 12:49:00 +01:00
Wim Taymans 1b88e0023b filter-chain: free plugin when load fails 2021-11-17 12:45:26 +01:00
Wim Taymans 6d492db948 impl-module: don't leak filename
When dlopen fails, don't leak the filename.
Fix indentation.
2021-11-17 12:43:46 +01:00
Wim Taymans 23ac9e5f3c module-access: improve pipewire.client.access handling
If a client (pipewire-pulse) has performed the access check and creates
a client with a specific access path, it will set this in the
pipewire.client.access property. For example, when a flatpak client
connects to pipewire-pulse, it will create a client with the flatpak
pipewire.client.access property.

Check the property after reading it so that we don't blindly grant
complete access to the flatpak client. Instead let the session
manager to assign the permissions.

This fixes a problem where flatpak clients entering pipewire-pulse would
initially get full access and then be downgraded by the session manager.
This would result in the pulse client thinking that it has access to
objects while failing later.
2021-11-16 17:27:05 +01:00
Wim Taymans a0e0a4d9d2 protocol-native: improve permission debug 2021-11-16 17:26:46 +01:00
Wim Taymans af2e7b630a pulse-server: turn error into info
Receiving a message from an already removed stream should not result in
an error message.

See #1812
2021-11-16 12:33:23 +01:00
Peter Hutterer 34847f117f systemd: extend the description for the socket files
Let's add PipeWire and Socket into the description, the current messages
are not overly obvious:
   Listening on Multimedia System.
   Closing Multimedia System.
2021-11-15 10:17:39 +10:00
Wim Taymans c03d10296b raop: connect TCP socket
Connect to the server TCP socket in TCP mode.
Use getaddrinfo to resolve hostname.
2021-11-13 21:00:24 +01:00