Commit graph

13743 commits

Author SHA1 Message Date
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
Taruntej Kanakamalla
608bf93f7a gst: sink: minor formatting fixes
follow up of !2337
2025-05-09 07:13:36 +00: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
Taruntej Kanakamalla
d5e2cc94cd gst: sink: update clock before every trigger process
Get the clock pointer using the io_changed stream event.
and update the clock before triggering the process

The clock needs to be updated in the data loop thread
and before triggering the process so move the calls to
`pw_stream_trigger_process` from gstreamer thread context
into the data loop thread context by invoking a callback
and update the clock inside the data loop callback
before the trigger
2025-05-08 18:57:44 +05:30
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
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