Commit graph

7887 commits

Author SHA1 Message Date
Wim Taymans 28370fc3cf jack: also call latency callback when buffersize changes 2021-12-03 17:58:25 +01:00
Wim Taymans 10e71264e7 resample: recalc rate match when out of buffers
When we don't have any input buffers, recalculate the rate match
size field so that we can know the size of the expected buffer.

We already do this when starting but it might have been done with
a different quantum.
2021-12-03 17:54:00 +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 401e56699d audioconvert: listen for merger and channelmix for params
List all the params of the merger and resampler.
2021-12-02 11:35:13 +01:00
Wim Taymans 5d85e85ba7 audioconvert: remove listener for resampler
When adding a listener, don't add a listener for the resampler because
it does not contribute to the result, we only listen for results from
the resampler.
2021-12-02 11:35:13 +01:00
Wim Taymans 73b5e7aec4 audioconvert: expose more config options
Use the PROP_param to list and configure additional config options.
2021-12-02 11:35:13 +01:00
Wim Taymans 385246f5a1 audioconvert: only update the arrays when valid
Only update our internal channelmap/volumes array when we actually
parsed something.
2021-12-02 11:35:13 +01:00
Wim Taymans 7b4b73ae5b channelmix: only remap volumes when we have a format
Or else we remap to 0 channels and lose all info.
2021-12-02 11:35:13 +01:00
Wim Taymans 77d66d73d1 audioadapter: return result from enum_param directly
There is no need to pass the result in an argument, just return the
value from the function.
2021-12-02 11:35:13 +01:00
Wim Taymans ebd2af612a settings: use default rate as allowed rates as fallback 2021-12-02 11:35:13 +01:00
Wim Taymans 57361ed0ee alsa: improve param log a bit 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 e31f9aa0f2 alsa: don't set id in PropInfo for params
The id is useless when dealing with props params, we need to use the
name of the property as the key. Also the id can clash with other ids
of other plugins.
2021-12-02 11:35:12 +01:00
Wim Taymans e3ddcc3b19 audioadapter: also update the follower PropInfo flags
So that we can enumerate them.
2021-12-02 11:35:12 +01:00
Barnabás Pőcze 0680e249e5 test: test-logger: ignore some systemd journal error codes
Some errors from `sd_journal_get_data()` are not (and
should not be considered) fatal from the point of view of
the test. Ignore them.

See #1710
2021-12-01 11:13:50 +01:00
Barnabás Pőcze 3d152db758 test: null terminate output buffers
Previously, the standard i/o stream and daemon logs
were not properly null terminated, which could cause
issues in `print_lines()` inside `log_test_result()`.

See #1710
2021-12-01 11:12:58 +01:00
Julian Bouzas 921a9038e1 spa: audioadapter: check if follower supports enum params before requesting them
Some follower nodes don't support all audioadapter params (For example, param
SPA_PARAM_Props is not supported by 'support.null-sink'). This change adds a
check to avoid unsuported errors when requesting a param that is not supported
by the follower.
2021-11-30 17:33:17 +00:00
Julian Bouzas 84e210ded9 spa: test: remove port EnumFormat param info
Both fakesink and fakesrc nodes don't support it.
2021-11-30 17:33:17 +00:00
Wim Taymans befe7b13eb alsa: add position and format to props params 2021-11-30 18:19:08 +01:00
Wim Taymans d673158db1 alsa: expose all config options as params
Add PropInfo for all the params that we can configure at construct
time and also add them as PROP_params.

This way you can configure the headroom at runtime with this:

pw-cli s <id> Props '{ params = [ "api.alsa.headroom" 1024 ] }'
2021-11-30 17:43:07 +01:00
Wim Taymans 2f82661966 spa: add description to PropInfo 2021-11-30 17:40:56 +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 3df6e77996 jack: handle regcomp errors 2021-11-29 12:46:50 +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 5cff20eba4 jack: handle chunk offset and size
Use offset and size in captured buffers and make sure we don't use more
than the allocated buffer size.
2021-11-25 15:17:42 +01:00
Wim Taymans e75282d0f5 alsa-plugin: clip offset and size in capture
Be a bit more careful with the offset and size in the buffer and make
sure we clip them according to the maxsize.
2021-11-25 12:32:24 +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 d79d2f69fb alsa: improve debug
Log the configured default_format.
2021-11-24 17:25:59 +01:00
Wim Taymans 955dde5272 alsa-plugin: use hw_avail in _delay for playback
for playback streams we want to include the hw_avail, which is the amount of
data that the hardware can read or the amount of data the application has
written.

This is in contrast to using _avail for the capture stream, which is
what the application can read. hw_avail for a capture stream is how many
samples the hardware can write or the amount of free space.

See #1697
2021-11-24 13:12:23 +01:00
Wim Taymans 743cced63e alsa-plugin: improve debug 2021-11-24 12:40:02 +01:00
Wim Taymans 301e729864 alsa-plugin: fix delay reporting
The delay should be calculated based on the amount of samples available
to the application, not the hardware.

This overreported the delay.

See #1697
2021-11-24 12:24:29 +01:00
Wim Taymans d8e24fca1c alsa-plugin: don't rate match for capture streams
For capture streams we can simple copy the complete pipewire buffer into
the alsa pcm ringbuffer to make it available for the application.
2021-11-24 12:24:29 +01:00
Wim Taymans 33f087d4db alsa-plugin: don't clamp elapsed time to stream delay
There is no reason to limit the elapsed time to the stream delay, it is
possible that it is larger and then it will be clamped later.
2021-11-24 12:24:29 +01:00
Wim Taymans 6f0c5b6428 alsa-plugin: improve debug 2021-11-24 12:24:29 +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 8995129e6c alsa: refactor property parsing
Move the common property parsing to the init function.
2021-11-23 12:27:36 +01:00