Commit graph

4090 commits

Author SHA1 Message Date
Barnabás Pőcze
01d1e29402 spa: vulkan: simplify kernel version parsing
Use a single `sscanf()` instead of multiple `strtok()`, `atoi()` calls.
After this change all three components are required to be present.
2025-05-14 18:37:54 +02:00
Wim Taymans
218f25088c convert: place the right id in the portconfig format 2025-05-14 18:21:39 +02:00
Wim Taymans
9b316f6deb filter-graph: remove port check
Remove the port number check, we never call this with an invalid port
number and the check was wrong for the sofa_plugin.

Fixes #4700
2025-05-14 17:04:06 +02:00
Wim Taymans
093b3eea21 audioconvert: implement graph latency reporting
Keep per graph latency. Sum all the graph latencies together and keep
this around as the process-latency.

Refactor the port latency setter. Make a function to recalculate the
latency of all other ports. Take into account the graph latencies.

Update the port latencies when the total graph latency changes.
2025-05-14 09:21:31 +02:00
Wim Taymans
c334bfb0bb audioconvert: do params after init of the node
First do the essential properties to set up the node, then set up the
node and then parse the params. The params might do some setup that
relies on a completely configured node, such as emit events.
2025-05-14 09:19:17 +02:00
Wim Taymans
37bf571db3 audioconvert: keep the graph latency around 2025-05-13 15:27:17 +02:00
Wim Taymans
2420c3a8c8 convert: refactor node_set_param functions
Move them to their own function to make the main function shorter.

Also make sure we emit the new ports first and then the node info.
2025-05-12 11:39:02 +02:00
Wim Taymans
8dfa086c3c audioconvert: refactor params
Move the param enumeration code out of the main enum function.

Emit node events after completion of the set_param functions to ensure
we only emit things once.
2025-05-12 11:39:02 +02:00
Pauli Virtanen
e5d0dd2020 bluez5: enable asha device set only if there's a device set
Now that ASHA uses device set, no need to special case here.
2025-05-11 16:14:40 +03:00
Wim Taymans
436195f05f control: only convert midi/UMP, pass other control types
We should only try to convert MIDI/UMP when the port doesn't support it
but let all the other control types pass through.

Fixes #4692
2025-05-09 09:34:34 +02:00
Sanchayan Maity
a5a6973472 bluez5-dbus: Fix another build failure on 32-bit system 2025-05-09 07:09:26 +00:00
Wim Taymans
f068e4ba85 alsa: rework the channel params
Avoid adding a None choice, just add one single value without a choice
when the min == max. In that case we can also add a channel position.
2025-05-08 18:17:45 +02:00
Wim Taymans
2d8080cbde alsa: only use default rate and channels when valid
Check the user provided rate and channels and only use them to limit the
rate and channels when they are valid.
2025-05-08 18:16:53 +02:00
Wim Taymans
ff0d6d5677 alsa: clamp audio.channels to MAX_CHANNELS
So that we don't end up trying to use too many channels later on.
2025-05-08 18:14:02 +02:00
Wim Taymans
b2695f86cf alsa-pcm: handle and warn about a driver bug wrt channels
If the driver returns a larger min than max channel count, log a warning
and swap the two numbers.

See #4687
2025-05-08 16:01:18 +02:00
Wim Taymans
bca83c8eee filter-graph: fix lv2 latency hint 2025-05-08 12:17:38 +02:00
Wim Taymans
68c5f41708 filter-graph: fix port find logic
We need both ports to be NULL (failed to find the ports as audio ports)
when we try to link control/notify ports.
2025-05-08 12:15:58 +02:00
Wim Taymans
46f5740604 filter-graph: warn about unaligned streams
Keep track of min/max latencies and warn when streams are unaligned.
2025-05-08 10:52:57 +02:00
Wim Taymans
8e4c211a80 filter-graph: add latency reporting to the sofa plugin 2025-05-07 17:19:38 +02:00
Wim Taymans
8bcf0460d1 filter-graph: add latency option to the convolver
Sometimes you want to use the convolver as a delay without adding
latency so add a latency option to tweak the automatic latency
reporting. Use this in the upmix rear delay filters.
2025-05-07 17:18:15 +02:00
Wim Taymans
8ee51cd88f filter-graph: add latency support for the delay plugin 2025-05-07 16:55:44 +02:00
Wim Taymans
dbca286de8 filter-graph: add latency reporting to the convolver 2025-05-07 16:37:14 +02:00
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
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
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
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