On glibc, `pthread_t` is `unsigned long int` while on musl
it has a pointer type. To avoid format string warnings,
cast it to `void *` and use the `%p` format specifier.
Delay output by one packet, so that we never need to wait for
node_process to supply more data when a packet is due out, and can write
audio packets at exactly equal intervals (up to timer/io accuracy).
In principle, this should not be necessary. However, enable it for now,
in case this improves the various stutter/etc. bug reports.
After flushing a packet, encode the next one immediately if we already
have the data. This makes the flush timing more accurate (std ~4x
smaller) as we don't need to wait for the encode.
* Add support for running the sink as a driver
* Detect which compressed formats are actually supported
* Correctly open/close/start/stop device according to the node commands
* Shift away from tinycompress and use Compress-Offload ioctls directly
to be able to access various caps information (including fragment sizes)
which are unavailable in the tinycompress API
* Implement SPA_PARAM_PropInfo and SPA_PARAM_Props support
When a stream uses the FIX_ flags it should negotiate to the format of
the sink or source it connects to. To do this, look up the sink or
source and look at the format, use this as the allowed format for the
stream when the FIX flags are set.
Make it still possible to override with with properties. Use
audio.position to make it possible to set a channelmap override.
The effect is that the null-sink will report the given format in the
Sample Specification, which is what some applications might expect when
they pass a format parameter.
Use a different key than the usual one to select an audio format when we
are fixating a stream format to avoid confusion.
So pulse.fix.rate, pulse.fix.format, pulse.fix.channels are now used to
force a specific format when the stream has the FIX_ stream flags.
The maximum receive buffer target of 6 packets may be too small when
there's huge jitter in reception. Increase it so that we may use all
buffer available if needed (2*quantum_limit = 370 ms @ 44100).
For SCO, explicitly set maximum buffer to 40 ms, so that latency cannot
grow too large there. For A2DP duplex, set it to 80 ms for same reason.
These are close to the old 6*packet limit.
Add support for using custom format, rate or channels when the streams
asks to fix those parameters for us.
Some streams might expect to see S16LE when they connect to a sink in
S16LE when the FIX_FORMAT flag is set but this is not the case in
PipeWire because the audio DSP pipeline works in F32, and so F32 is
choosen. Make it possible to use a pulse.rule with a audio.format
property to control this.
Make pw_getrandom() more usable by handling the EINTR case and returning
< 0 when there was an error or not enough random data was available.
Make a new pw_random() function that uses pw_getrandom() but falls back
to a pseudo random number generator otherwise. This pseudo random number
generator is seeded with either data from the urandom source or from the
current time when pipewire is initialized.
In most cases where crytographic security is not required pw_random()
should be easier to use.
For BAP server audio sink, set buffering target so that we try to match
the target presentation delay. Also adjust requested node latency to be
smaller than the delay.
Also fix BAP transport presentation delay value parsing, and parse also
the other BAP transport properties. Of these, transport latency value
needs to be taken into account in the total sink latency.
Promote the following warnings to errors:
* implicit-function-declaration
* int-conversion
because the code very likely will not work
correctly if any of these two trigger.
When pw_stream receives a proxy error it does not set its state to an
error state on its own, commenting:
```
we just emit the state change here to inform the application.
If this is supposed to be a permanent error, the app should
do a pw_stream_set_error()
```
Until now this was not done in the pipewiresrc, resulting in the
negotiation loop to not bail out after an error as a successive
`pw_stream_get_state()` did not return an error state.
Make the error permanent so negotiation errors make us take the
appropriate error paths.
The data stride for encoded formats should be 1 and also placed in the
stride in the buffer (not 0). So there is really no difference with the
regular codepath.
This commit implements generating /etc/security/limits.d/20-pw-defaults.conf and
/etc/security/limits.d/25-pw-rlimits.conf files. The numbering is arbitrary and
may very well warrant being in the reverse order, however `man 5 limits.conf`
does not appear to specify the parsing order or even say exactly how multiples
matches will resolve, so the value can be adjusted later, if required.
The actual limit values, the match rule and even whether each file is to be
installed can be changed via the build system before compilation. Likewise
the files can be modified or (re)moved during distro package building phase.
The 20-pw-defaults.conf should only be installed on legacy systems lacking both
a modern kernel and up to date systemd, because all it does is set the current
Linux default. Accordingly its not installed by default.
Signed-off-by: Niklāvs Koļesņikovs <89q1r14hd@relay.firefox.com>
Use a 0 mask to handle unknown layouts. When the source or destination
is an unknown layout, pair, distribute or average. When pairing, keep
track how we paired and use that to construct the matrix later.
This fixes [ UNK UNK ] -> [ FL FR ] mapping by pairing.
Actually return the pointer to the created object
from `impl-core.c:core_create_object()` instead of
returning a NULL pointer.
This has not caused issues because the return value
is not checked anywhere.