In a scenario where pw-link is called without a session manager running,
the output port on a node will not exist. In such a case, we broke out
of the for loop with all_links_exist set to true and returning EEXIST.
The return of EEXIST gives a confusing error message. Fix this.
uint32_t i;
for (i = 0; i < SPA_N_ELEMENTS(some_array); i++)
.. stuff with some_array[i].foo ...
becomes:
SPA_FOR_EACH_ELEMENT_VAR(some_array, p)
.. stuff with p->foo ..
This fixes several integer overflow problems in the POD parser, as well
as fixing a returns-twice warning from GCC and integer truncation
problems in SPA_FLAG_CLEAR and SPA_ROUND_DOWN_N. The integer overflows
can result in a tiny POD being treated as a huge one, causing
out-of-bounds reads.
When no maxlength is given, we use the MAXLENGTH value but we need to
round it DOWN (instead of up) because our buffer is only MAXLENGTH big.
Use CLAMP where we can.
When in capture mode, the maxlength exceeds MAXLENGTH, scale down the
fragsize instead.
Fixes noise in audacious when playing 6 channels sounds. float32 * 6
channels with the maximum buffer size would result in the ringbuffer
being overwritten.
Some clients may send headers with trailing whitespace, which can upset
subsequent parsing of the data into numbers. This patch removes such trailing
whitespace before further processing the header data.
Some Airplay devices announce themselves as using the ALAC (Apple Lossless Audio
Codec) format, while pipewire only supports the PCM codec. A look at the
Pulseaudio RAOP reveals that ALAC is supported there, but the encoding looks
exactly like what pipewire does for PCM. This patch adds support for ALAC, but
it uses the existing PCM infrastructure to send the audio data.
When we are starting a node and need to cancel it, only set the node
to the paused state when pause_on_idle is set. Use the pause_node
function to make sure everything is in the paused state.
Otherwise we would send a Pause command to the node but because it was
still added to the graph we would continue to call the process function
on it.
Fixes#2701