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.
There is a use case where you may want to use audioconvert with
both input & output sides configured in dsp mode, for altering
the stream volume. When it is configured like that, the
IS_MONITOR_PORT macro wrongly thinks that all output ports except
the first one are monitor ports, originating in the merger instead
of the splitter.
This change fixes that and it also completely disables exposing
monitor ports, even if they are enabled, when both sides are in
dsp mode (fmt_input_port_info() also uses the same macro to check
if the monitor ports are to be exposed)
We can produce data whenever the io area status != HAVE_DATA. We
don't need to look for NEED_DATA.
Also recycling buffer happens whenever the status != HAVE_DATA.
This is more in line with wayland and it allows us to create new
interfaces in modules without having to add anything to the type
enum. It also removes some lookups to map type_id to readable
name in debug.
Send suspend to the node when suspending. This is usually the same
as puse for all nodes.
Implement negotiation when we Start audioadapter. This makes it
easier that to track the ports that are negotiated for now.
Use Suspend to clear the audioadapter negotiation.
clean_convert() removes the internally negotiated formats but
it does not set the format (or buffers) of the externally visible
ports. Therefore, don't clear the buffers_set flags.
Instead, clear the buffers_set flag when we explicitly reconfigure
the ports, when we also clear the format.
Also clear the port buffers when we set a NULL format.
Fixes#178
Add a new PortConfig parameter to configure ports of elements that
are marked with the SPA_NODE_FLAG_*_PORT_CONFIG. This is used to
configure the operation of the audioconver/audioadapter nodes and
how it should convert the internal format. We want to use the
Profile parameter only for cases where there is an enumeration of
values, like with device configuration.
Add unit tests for audioconvert and adapter to check if they handle
PortConfig correctly.
Make the media session use the PortConfig to dynamically configure
the device nodes.
Remove audio-dsp, it is not used anymore and can/should be implemented
with a simple audioconvert spa node now and some PortConfig.
Remove the CAN_USE_BUFFERS flag, it is redundant. We can know this
because of the IO params and buffer params.
Add flags to the port_use_buffer call. We also want this call to
replace port_alloc_buffer. Together with a new result event we can
ask the node to (a)synchronously fill up the buffer data for us. This
is part of a plan to let remote nodes provide buffer data.
Use a new rate_match io area to exhange rate matching info between
sink/source and resampler.
Compensate for the rate match delay when scheduling timeouts.
Let the resampler notify the source of how many samples it needs to
produce the desired quantum. Make sure we keep an extra buffer in
the device to be able to make this possible.
Let the adapter directly call the slave node process function.
Define a set of standard factory names and document what they
contain. This makes it possible to change the implementation by
mapping the factory-name to a different shared library.