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
Reducing the latency is just papering over the issue in #2702. The
real fix is to limit the blocksize to the fragsize like what is done
in 00a234daf2
Reducing the latency then also causes regressions like #2715 so don't
do that anymore.
Fixes#2715
Instantiate the graph nodes when the samplerate is known instead of
using a fixed samplerate of 48KHz.
Warn when the convolver samplerate does not match the graph rate. We
might want to resample the IR later.
Suspend all nodes of the driver, even if the driver is already
suspended.
The suspend command makes sure that all nodes renegotiate to the new
graph rate.
This fixes the following sequence of events:
1. Play 44.1KHz file to loopback sink
2. Sink switches to 44.1, negotiates to 44.1
3. Loopback input and output streams negotiate to 44.1. All is good.
4. Stop playback, wait 5 seconds
5. Sink suspends, loopback input suspends (output stream doesn't suspend)
6. Play 48KHz file
7. Sink switches to 48, negotiates to 48. Sink (and followers) don't
suspend because sink was already suspended.
8. loopback input negotiates to 48, output stays at 44.1 -> failure
This patch fixes step 7. where it now tries to suspend all followers
even when the driver was already suspended. This then ensures that all
followers will try to negotiate to the new driver rate.
Use a reference to the location in the node where the handle of the
plugin can be found. That way we can change the handle only in the
node and have it changed everywhere else.
Add a process_playback function and use _trigger in the process_capture
to start processing. This ensure that the requested size is updated
before calling the process function.
We always need to update the latest requested size for output streams
before calling process. If there are no buffers or no suggestion, let
the audioconvert make one before we try again.
This way we always get the most recent requested size.
In monitor mode, we only need one sync to get the prompt and then we
just wait until we need to stop. There is no need to keep on syncing
because it consumes a lot of CPU.
Patch by Hiero32
Fixes#2709
Add methods activate() that is called before first call to run() when
stream starts and deactivate() that is called after last call to run()
when stream stops. This makes it possible for aec-plugins to reset their
state between streams.
When a port name contains a ':' we will try to split it and use the part
before the colon as the node name, which will then fail.
If we can't find a node name after splitting, try again by assuming the
colon is part of the port name.
Fixes control port names such as "Ratio (1:n)" in #2685