Commit graph

13725 commits

Author SHA1 Message Date
Wim Taymans
e545efdb6e filter-chain: implement filter-graph latency
Collect the latency of the graph in filter-chain. We do this by first
inspecting the LATENCY ports on the plugins and us the notify value as
the latency on the node.

We then walk the graph from source to sink and for each node take the
max latency of all linked upstream peer nodes. We end up with the max
latency of the graph and emit this in the graph properties.

We then listen for the graph latency property and use that to update the
process_latency of the filter-chain, which will then update the latency
on the filter-chain ports.

Fixes #4678
2025-05-07 16:00:41 +02:00
Wim Taymans
d277b3b62e filter-graph: add a LATENCY hint for control ports
Some ports can have latency information about the plugin, mark those
ports with the LATENCY HINT.

Also decouple the LADSPA hint flags from the SPA ones.
2025-05-07 16:00:41 +02:00
Wim Taymans
5a4e8bb45e filter-graph: ensure we can call setup_graph multiple times
We need to reset the fields used for sorting so that we can run the
setup_graph code multiple times.
2025-05-07 16:00:41 +02:00
Wim Taymans
a30a988606 filter-graph: remove useless check 2025-05-07 16:00:41 +02:00
Sanchayan Maity
42b9b0eb4c bluez5-dbus: Fix the audio channel position for ASHA
For stereo to work, we need to advertise the channel position based on
whether the side is left or right.
2025-05-07 18:29:01 +05:30
Wim Taymans
5bf3a0c454 filter-graph: add a debug node
Add a node that logs audio or control data to the log.
2025-05-07 10:44:57 +02:00
Guido Günther
958ae36717 spa: Add default: statements
This allows to use the library in projects that use `-Wswitch-default`
without any

 #pragma GCC diagnostic push
 #pragma GCC diagnostic ignored "-Wswitch-default"
 #pragma GCC diagnostic pop

This is useful as as the header is being pulled in via
pipewire/wireplumber headers into projects that might have this warning
enabled and would otherwise fail to build with -Werror.

Signed-off-by: Guido Günther <agx@sigxcpu.org>
2025-05-07 07:42:39 +00:00
Frédéric Danis
27fecd3c56 bluez5: backend-native: Fix hangup of waiting call
3-way incoming calls are created in waiting state. When those calls are
hang-up before being active, the +CIEV: (callsetup = 0) should also be
managed for waiting calls.
2025-05-07 07:41:28 +00:00
Sanchayan Maity
afa7ebc032 media-sink: Drop packet if send fails for ASHA
One of the ideas behind retrying the sending of a failed packet with the
poll callback was to make sure that we do not end up with missing seqnums
by missing received credit due to some jitter.

However, the rate matching behaviour for ASHA is not clear and we do not
seem to face problems in local testing by just dropping the packet.
2025-05-07 07:39:46 +00:00
Sanchayan Maity
e68111b4aa media-sink: Fix sequence number sync for ASHA
The two sides of a ASHA pair rarely if ever start together and the
sequence number was always a bit off due to the stateful nature of
reset_buffer and ASHA needing the sequence number to be matched to
the other side.

Simplify this by setting the sequence number for ASHA just before
flushing.
2025-05-07 07:39:46 +00:00
Sanchayan Maity
a419f69bbb bluez5-device: Refactor device_set_update for ASHA & BAP 2025-05-07 07:39:46 +00:00
Wim Taymans
445ca819ce bluez: fix format specifier
zu is for size_t, PRIu64 is for uint64_t
2025-05-07 09:38:24 +02:00
Sanchayan Maity
d96485190d bluez5: media-sink: Fix format specifier for log
This should fix the build on 32-bit systems.
2025-05-07 13:02:10 +05:30
Wim Taymans
8c8fd97698 filter-chain: support ProcessLatency
Allow setting ProcessLatency on the nodes and add this latency to the
reported Latency.

See #4678
2025-05-06 19:15:16 +02:00
Wim Taymans
20246b5c0e netjack2: add driver.mode again
This configures the default number of audio and midi ports per stream
to 0 depending on the mode.

Improve docs a little.

See #4666
2025-05-06 10:44:14 +02:00
Wim Taymans
0ebf664515 videoconvert: refactor add_video_formats
Rework the function a little so that it can take a list of formats and
only add the supported formats from that list and only once. It can
optionally select only the DSP formats.
2025-05-06 10:07:09 +02:00
Wim Taymans
df2369f6e1 videoconvert: fix enum format for control and dsp ports
They just have 1 format object.
2025-05-06 09:28:13 +02:00
Wim Taymans
6161cb3ec5 videoadapter: disable ffmpeg converter by default again 2025-05-05 13:19:54 +02:00
Wim Taymans
1904521a4d videoconvert: add PeerFormats support
Make a new PeerFormats param that can be set on ports to let it know
about the possible peer formats. This can be used by converters to calculate
an optimum conversion.

make the videoadpter query the follower formats, simplify them and then
set them as PeerFormats on the converter.

Implement peerformats in videoconvert. This makes EnumFormat on the port
depend on the negotiated format of the peer. It will suggest a Format
that most closely matches the current negotiated format with the available
PeerFormats. This then makes it possible to negotiate to the format that
would require the least amount of conversions.
2025-05-05 12:59:06 +02:00
Wim Taymans
46d376cb78 videoconvert: pass the param id to enum functions 2025-05-05 12:54:41 +02:00
Wim Taymans
80f700876d videoconvert: refactor enum_params
Move the enum_param implementation out of the main enum_param loop.

This makes it easier to read the individual functions.
2025-05-05 12:45:41 +02:00
Wim Taymans
aedbe51043 videoconvert: move get_format around 2025-05-05 12:12:09 +02:00
Wim Taymans
6373827a40 videoconvert: use a table for format conversion
Use a table with format conversion values so that we can also use
flags for the formats.
2025-05-05 12:10:02 +02:00
Wim Taymans
86dd937857 videoconvert: move event emission at end of functions
Make a function to emit all pending events and trigger it at the end of
operations that can change params.
2025-05-05 11:54:18 +02:00
Wim Taymans
77e6471a04 videoconvert: free codec resources
Free encoder and decoder resource properly when we renegotiate.
2025-05-05 11:20:15 +02:00
Wim Taymans
4dd98b4ff8 videoconvert: Use converter direction from properties 2025-05-05 11:19:15 +02:00
Wim Taymans
df52086c47 videoconvert: always restore old change_mask 2025-05-05 11:17:23 +02:00
Wim Taymans
399ff82ab2 adapter: always negotiate from convert to follower
Make the converter format a higher priority in all cases. The converter
has been negotiated first and is able to make a better suggestion for
the ideal format in all cases.
2025-05-05 10:33:07 +02:00
Wim Taymans
14eb03a821 videoconvert: Enumerate follower params better
Make sure we increment the next counter even when we are in passthrough
mode or the property is not readable.
2025-05-05 10:31:37 +02:00
Wim Taymans
faf5ae0c2f impl-link: improve negotiation
Make a function to create a filter. This is a pod that has all valid
defaults fixated and the invalid ones left unfixated.

Use this filter is a first attempt to negotiate a link format. The
effect is that a format will be chosen first that matches all the valid
defaults as much as possible instead of negotiating to the first thing
that matches.

Suppose we have a higher priority port with the format:

 foo/bar
    key: { default:1024, min:1, max:2048 }

And another port with two params:

 foo/bar
    key: 512
    rate: 2/1
 foo/bar
    key: 1024
    rate: 30/1

By first trying key: 1024 we negotiate to the more specific second property
with the higher rate.
2025-05-05 10:12:26 +02:00
Wim Taymans
9255e07c3a pod: move related functions closer to eachother 2025-05-05 10:04:26 +02:00
Wim Taymans
2940c9ff7b examples: add rate as a constant 2025-05-05 09:45:57 +02:00
Pauli Virtanen
584ea400c3 bluez5: fix spelling "Headphone" -> "Headphones"
"Headphone" is usually plural
2025-05-05 07:45:24 +00:00
Pauli Virtanen
270eda63a9 bluez5: different icon for A2DP & HFP output routes
Set different icons for A2DP & HFP output routes, so that they look
different (in Gnome).

Don't call the non-HFP output route as "headset" or "handsfree" in this
case, to be less ambiguous about microphone availability.

Also set device.icon-name for the device too.
2025-05-05 07:45:24 +00:00
Sanchayan Maity
9586ef891e bluez5: Use device set for ASHA
While ASHA does not really use the D-Bus device set interface
but since ASHA has a device-wide HiSyncId and needs to handle
left and right side via a combine sink, use the device set
notion for ASHA as well.
2025-05-05 07:43:34 +00:00
Sanchayan Maity
1b6830f68f bluez5: media-sink: Improvements for ASHA
Clean up as per feedback from Pauli and Barnabás.
2025-05-05 07:43:34 +00:00
Arun Raghavan
b02b69b271 bluez5: media-sink: Drop a redundant ASHA state variable 2025-05-05 07:43:34 +00:00
Arun Raghavan
ce8abfc5cc bluez5: media-sink: Refine ASHA other-side timer setup further
Let's just directly use the next timer value from the other side
directly, and the reference time as well to calculate the expected next
sample position we want to send from on this side.
2025-05-05 07:43:34 +00:00
Arun Raghavan
c5b5476aa4 bluez5: media-sink: Skip samples to align audio data for ASHA
For ASHA, we want the media sinks to send packets where the ASHA packet
sequence number corresponds to time position of audio in that packet.
2025-05-05 07:43:34 +00:00
Arun Raghavan
efb4a1df25 bluez5: media-sink: Snap timer to ASHA connection interval
For ASHA stereo, the timer for flushing packets on both sides of a
pair should be as closed to each other as possible.

Also set seqnum before first flush so other side sends the correct
packets at the start.
2025-05-05 07:43:34 +00:00
Arun Raghavan
4d22296d3a bluez5: media-sink: Use reference time for ASHA sequence numbers
This improves the sequence number generation by tying it to
get_reference_time.
2025-05-05 07:43:34 +00:00
Sanchayan Maity
24843a73c0 bluez5: media-sink: Support for ASHA stereo 2025-05-05 07:43:34 +00:00
Sanchayan Maity
69b5fe8395 bluez5: g722: Do not set sequence number in start_encode
In ASHA, we might need to sync sequence numbers between
left and right side media sink. If the sequence number
is added in start encode, it becomes difficult to set
the sequence number again when a call to reset_buffer
in media sink might have happened already.

This effectively reverts commit ab5f81b9a.
2025-05-05 07:43:34 +00:00
Sanchayan Maity
db47c3e442 bluez5-device: Expose HiSyncId and Side information on ASHA node 2025-05-05 07:43:34 +00:00
Sanchayan Maity
74fe7728d2 bluez5: media-sink: Set up node group for ASHA
ASHA devices with the same HiSyncId should use the same
node group/driver.
2025-05-05 07:43:34 +00:00
Sanchayan Maity
8120493edb bluez5-dbus: Track ASHA HiSyncId & Side information in transport
ASHA devices with the same HiSyncId are a pair and this
will be used later on to set them up together with a
combine sink like device set for BAP. Side information
is required for channel information when setting up the
combine sink.
2025-05-05 07:43:34 +00:00
Frédéric Danis
612cbf5176 bluez5: hfp-hf: Fix HFP HF states
hfp_hf_slc1 is not used so remove it, and rename hfp_hf_slc2 to
hfp_hf_clcc to be consistent with other states.
2025-05-05 07:41:06 +00:00
Frédéric Danis
533c67710e bluez5: backend-native: Fix rfcomm_send_volume_cmd()
This function always returns true. Change to not returning anything.
2025-05-05 07:41:06 +00:00
George Kiagiadakis
8e62b08e58 bluez5: hfp-hf: don't change hf_state after sending AT+BCS
The +BCS event may interrupt any of the initialization commands after
SLC is established and by changing the state here we may lose track
of the initialization sequence.

There is no reason to have the hfp_hf_bcs state anyway. If the
initialization sequence is over, we can remain in the hfp_hf_vgm state.
2025-05-05 07:41:06 +00:00
Stefan Binding
7f07448a80 spa: acp: Allow Volume control which supports mute to be used as a hardware mute
Some devices have a hardware volume control, but not a dedicated
hardware mute control. In some of these cases, the volume control is
described as having a hardware mute when volume is 0. This is described
in the TLV information of the volume control, when the
SNDRV_CTL_TLVD_DB_SCALE_MUTE flag is set in the TLV structure.
If set, alsa-lib will set the minimum dB value to -99999.99dB, which
can be detected inside PipeWire.

PipeWire can then use this hardware volume control to apply hardware
mute, when set.

In order to be able to set volumes and mutes separately, changing the
volume whilst muted will save the value, but not write it to the
hardware. When the device is unmuted, the saved value will be restored.

Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
2025-05-05 07:40:29 +00:00