Add an empty.noise option that specifies the number of bits to
use for noise when the input signal is pure silence.
Some amplifiers can go into suspend mode pretty easily when they
get pure silence. With empty.noise = 1, audioconvert will now generate
a bitpattern that can keep those amplifiers alive, together with
disabling suspend in the session manager.
Fixes#705
Add an EMPTY chunk flag to mark a piece of memory as 'empty'. For audio
this means silence.
Use the empty flag to avoid mixing 0 samples.
Set the empty flag in output buffers on audioconvert.
this->monitor enabled adds an additional port in reconfigure_mode. If
there was already the maximum 64, this will crash.
Make maximum number of ports one larger than max channels to avoid
problems.
Only advance the in_offset with the number of samples that were consumed
by the resampler. In case when the resampler is filling up an old
buffer, this can be less than n_samples.
Fixes a2dp source and possibly others.
Use the offset to skip entries in the sequence array.
Use one loop to handle intermediate and trailing samples.
Fixes an issue where the last chunk of a sequence would be ignored.
Ignore latency params on the monitor ports of merger. They interfere
with the latency reporting set by the adapter.
The adapter will set the latency param from the follower on port 0 in
the converter, so pass this on to the merger as the latency and ignore
all other updates.
Fixes a case where the latency of a sink would become 0 when a monitor
port was recorded from.
Make the alignment parameter optional when negotiating buffers.
Default to a 16 bytes alignment and adjust for the max cpu
alignment.
Remove the useless align buffer parameter in plugins, we always
set it to 16 anyway.
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.
When in passthrough mode, use the position io to update the
io_rate_match fields for the follower. This makes it possible for the
follower to also provide the right amount of data when the converter
is not selected in passthrough.
Add an option to configure the converter in None port config where it
removes all the ports. We can use this when removing the converter to
make sure all it's ports are removed.
When we remove the converter, make sure we expose the follower ports
directly so we can use them for passthrough.
Mark some structures, arrays static/const at various places.
In some cases this prevents unnecessary initialization
when a function is entered.
All in all, the text segments across all shared
libraries are reduced by about 2 KiB. However,
the total size increases by about 2 KiB as well.
When setting the Latency parameter on one side of the converter, set
it also on the other size. We should actually implement propagating
the latency through all the elements of the converter later.
Implement latency handling on fmtconvert.
merger and splitter change latency on all ports when on port changes.
All this makes the configured and exposed latencies visible on all
ports from adapter.
Implement a port recalculate latency method that takes the min
and max latency of all peer ports and sets that as the new port
latency.
When a link is made, let the output and input port recalculate
latencies.
Pass latency param in audioconvert.
When we add a new listener to an object, it will emit the full state
of the object. For this it temporarily sets the change_mask to all
changes. Restore the previous state after this or else we might not
emit the right change_mask for the next listener.
Consider the case where one there are two listeners on an object.
The object emits a change and the first listener wants to enumerate the
changed params. For this is adds a new listener and then triggers the
enumeration. If we set the change_mask to 0 after adding the listener,
the second listener would get a 0 change_mask and fail to update
its state.
SPA_MEMBER is misleading, all we're doing here is pointer+offset and a
type-casting the result. Rename to SPA_PTROFF which is more expressive (and
has the same number of characters so we don't need to re-indent).
Keep all the children param flags around and use those to decide
if something changed. Also don't change the param flag serial when
we are simply adding a listener.
This should reduce the number of param updates, most notably the
PropInfo that was updated along with the Props on volume changes.
Keep track of the param changes with the user counter. Make sure to
flip the serial switch whenever a change is pending. Previously
we copied the param from the channelmixer or follower but that
did not always result in a serial change.
Fixes#764
Implement monitor volumes in the merger. There are two volumes,
the channel volume and the monitor volume. The monitor volume
is always applied.
By default the monitor volume will now follow the main volume of
the node. This can be disabled with a monitor.channel-volumes
property.
See #674
This is needed for example for Clang compiler which uses different
annotations than GCC. It will make WebRTC to happily use PipeWire
since the spa library is header-only and WebRTC defaults to use
Clang with -Wimplicit-fallthrough.
Add a new node flag that is set when the node needs more configuration.
Don't try to Start nodes that have the NEED_CONFIGURE flag set.
Make audioadapter clear the NEED_CONFIGURE flag when it has the
PortConfig.
These changes now make it possible to run:
gst-launch-1.0 -v pipewiresrc path=51 stream-properties="props,node.group=1" ! audio/x-raw ! pipewiresink stream-properties="props,node.group=1"
The pipewiresink and pipewiresrc will be added to the same scheduling
group (1) and the devices they connect to will be slaved, even if they
are otherwise not linked.
Without the NEED_CONFIGURE flag, pipewiresink would be added to the
pipewiresrc group and would be started by the daemon before the
session manager has a chance to configure (and link) the node.
Fixes#4
Make a new DRAINED status.
Place the DRAINED status on an input IO when a stream is out of
buffers and draining.
All nodes that don't have HAVE_DATA on the input io need to copy
it to the output io and return the status. This makes sure the
DRAINED is forwarded and nodes return DRAINED from _process()
DRAINED on the resampler flushes out the last queued samples and then
forwards the DRAINED in the next iteration.
Emit a new drained signal from the context when a node returns
DRAINED. Use this to trigger the drained signal in the stream.
We should not have to initialize the state to NEED_DATA, anything
that is not HAVE_DATA is good. Also we need to set the buffer to
INVALID because else it might be recycled.