Commit graph

253 commits

Author SHA1 Message Date
Wim Taymans
cd81b5f39a spa: add spa_json_begin_array/object and relaxed versions
Add spa_json_begin_array/object to replace
spa_json_init+spa_json_begin_array/object

This function is better because it does not waste a useless spa_json
structure as an iterator. The relaxed versions also error out when the
container is mismatched because parsing a mismatched container is not
going to give any results anyway.
2024-09-16 09:50:33 +02:00
Wim Taymans
40cd8535eb audioconvert: only accept UMP on the control port 2024-07-30 09:38:40 +02:00
Wim Taymans
61dcd8dede audioconvert: set IO_Buffers only when buffers are negotiated
The IO_Buffers is used in the data thread to check if the port should be
scheduled or not. Make sure it is only set after we set buffers on the
port and cleared before the buffers are cleared.

Make sure we sync the port->io with the data thread.

See #4094
2024-07-29 18:15:06 +02:00
Wim Taymans
9d1d1fcbef impl-port: add port.group property
Can be used to group ports together. Mostly because they are all from
the same stream and split into multiple ports by audioconvert/adapter.

Also useful for the alsa sequence to group client ports together.

Also interesting when pw-filter would be able to handle streams in the
future to find out what ports belong to what streams.
2024-06-24 13:38:09 +02:00
Diego Viola
7410755c03 Fix typos
found them with codespell.

Signed-off-by: Diego Viola <diego.viola@gmail.com>
2024-05-22 09:19:34 +02:00
Wim Taymans
b97c6e2eac audioconvert: also clamp monitor volume to min/max
When we set a min/max value, also clamp the monitor volume to it.

Fixes #3962
2024-04-15 16:28:24 +02:00
Wim Taymans
ea524b158c audioconvert: add monitor.passthrough option
Add a monitor.passthrough option. This will pass all latency information
directly between the port and its monitor ports.

This is interesting when the adapter (and audioconvert) is used with a
null-audio-sink that simply forwards the data to a real sink/souce. In
that case, we want the sink/source latency to be passed unmodified.

Set the monitor.passthrough on the pulseaudio null-sink because
a passthrough virtual sink is the most likely use case for this.

Add some monitor.passthrough default config where it makes sense.

Fixes #3888
2024-03-11 16:20:27 +01:00
Wim Taymans
a82e95c37d audioconvert: handle invalid ports better
Keep track of the valid ports and don't emit port info for
invalid ports. When a listener is added while the ports are being
created, it is possible that the ports are still NULL or invalid.
2024-02-28 11:29:01 +01:00
Wim Taymans
86af9de739 adapter: remove factory.mode property
We can deduce this from the way the node is configured with the
PortParam now.
2024-02-23 16:28:11 +01:00
Wim Taymans
627f148665 audioconvert: also place resample output in rate_io
We can also place the estimated size that the resampler will produce in
the rate_io for output streams.

See #3750
2024-01-16 13:29:57 +01:00
Wim Taymans
63e283f377 audioconvert: update initial resampler rate match
When starting the converter, calculate the initial size needed by
the resampler to fill one quantum.

This makes it possible to get the requested amount of samples before
the first process call is made.
2024-01-15 15:03:54 +01:00
Pauli Virtanen
eaea03c26c spa: export log topic enumerations 2024-01-04 10:02:55 +00:00
Wim Taymans
c94d5d9d34 audioconvert: improve allocation
Don't try to allocate each time port buffers are set but only once
before we start procesing.

Also allocate enough temp buffers are there are ports. This saves us
quite a bit of memory in the normal case.
2023-10-13 18:05:42 +02:00
Wim Taymans
11320cf203 tweak number of buffers
In most cases we can use just 1 buffer.

The alsa-pcm-source needs at least 2 buffers so increment the min
limit.
2023-10-13 14:00:29 +02:00
Barnabás Pőcze
8256a2d5a6 spa: remove unnecessary indirection for some spa_log_topics
This results in shorter machine code since it removes one
pointer load and a NULL check.
2023-10-06 13:08:24 +00:00
Wim Taymans
14114a7386 audioconvert: warn -> debug 2023-10-03 20:39:40 +02:00
Wim Taymans
48e11c6fe0 audioconvert: handle realloc errors
The original pointer is untouched when realloc fails and returns NULL so
make sure we free the previous values.
2023-10-03 20:38:11 +02:00
Wim Taymans
c4944dad17 audioconvert: silence some debug info 2023-09-27 11:44:31 +02:00
Wim Taymans
016d15e598 ratelimit: missed -> suppressed
To avoid confusing with missed samples.
2023-09-08 12:18:23 +02:00
Wim Taymans
ebeae802ad audioconvert: improve tag and latency handling
Don't just forward the tag and latency events to the follower but let
the audioconvert aggregate and emit the updated tag/latency event
that is then configured on the follower.

When using the DSP mode of the audioconvert, this results in an
accumulated latency/tag from all the DSP ports instead of just
the last DSP port param update.

Put properties with media. prefix in tags in pw-cat.
2023-09-07 15:27:21 +02:00
Wim Taymans
41dcac0ecd Port: Add tag param
The tag param has a list of arbitrary key/value pairs. Like the Latency
param, it travels up and downstream. Mixers will append the info
dictionaries or do some more fancy merging.

The purpose is to transport arbirary metadata, out-of-band, through the
graph and it's used for stream metadata and other stream properties.
2023-08-29 14:22:13 +02:00
Wim Taymans
b9d78d5992 audioconvert: add queued input to the delay
The input that we have queued will also add to the resampler delay.

Fixes #3454
2023-08-22 13:06:10 +02:00
Wim Taymans
71262da6d7 audioconvert: remove requirement for data_loop
We just need to get a timestamp so that we can do the rate limiting, we
don't need anything accurate from the data_loop.
2023-08-01 18:20:04 +02:00
Wim Taymans
536129343a audioconvert: rate limit the out-of-buffer logging
See #3384
2023-08-01 15:06:28 +02:00
Wim Taymans
35d932bc8b audioconvert: only dequeue a buffer when queued
Add an extra check to only dequeue a buffer when it's queued. This
should always be the case but let's check again to be safe.

See #3384
2023-08-01 15:04:31 +02:00
Wim Taymans
ad1a36a718 audioconvert: add option to disable volume updates
Add channelmix.lock-volumes. When set to true it will disable volume
updates until set back to false.

See #3361
2023-07-25 12:36:23 +02:00
Wim Taymans
ab1436fb3b audioconvert: improve EMPTY flag on output buffers
Only set the EMPTY flag on output buffers if we don't have any
previously queued samples and the input is EMPTY.

Fixes #3365
2023-07-19 21:39:25 +02:00
Wim Taymans
baa5497617 spa: warn out of buffers
Running out of buffers is pretty bad and warrants a warning because it
can cause loss of audio.

See #3316
2023-07-07 12:11:02 +02:00
Wim Taymans
0156d63109 audioconvert: don't negottiate rate when resample is disabled
This will leave the negotiated rate 0 when parsed and instructs the
stream to follow the graph rate.
2023-06-26 11:23:29 +02:00
Wim Taymans
d04e430f23 audioconvert: add channelmix.mix/max-volume param
And clamp the volume values between these two. This can be used lock the
voluem to value or do some volume limit.
2023-06-15 11:06:52 +02:00
Wim Taymans
05ea4520e6 audioconvert: improve debug 2023-06-14 16:57:13 +02:00
Wim Taymans
09f480ccb3 audioconvert: fix monitor port latency
The monitor port latency is the reverse direction of the input ports.
2023-05-25 20:05:54 +02:00
Wim Taymans
ae9262409f audioconvert: suggest to inline some functions 2023-05-18 10:21:47 +02:00
Wim Taymans
e3cfd73b9e audioconvert: use target_rate/quantum when starting
When the node is starting and negotiating, use the target_rate and
quantum because that is what is going to be used in the next cycle.
2023-05-09 15:53:36 +02:00
Wim Taymans
9967c35bbe audioconvert: exit early to ask more data
We don't need to peek all the output buffers before deciding that we
need more data. Just check if we have input, if not ask more data.
2023-05-05 21:34:53 +02:00
Pauli Virtanen
6e17962ad0 impl-port/audioconvert: add PORT_IGNORE_LATENCY
Add port.ignore-latency prop, which if true causes peer ports to ignore
the latency of the given port.

This is useful for ports that are not intended to affect latency
calculations of other ports, such as ports in monitor streams.
2023-05-03 18:01:00 +00:00
Wim Taymans
b262812643 audioconvert: always allow peaks resampler
When we're using the peaks resampler, allow resampling, even when it is
disabled in the config.

The peaks resampler is just for GUI and would not really change the
signal, so we can allow this.
2023-04-27 17:10:41 +02:00
Wim Taymans
edf2062830 fix compilation 2023-04-05 19:53:33 +02:00
Wim Taymans
6dcf0027d8 audioconvert: implement mix/resample_disabled
Fail when resampling or channelmixing is required but disabled.
2023-04-05 19:51:16 +02:00
Ashok Sidipotu
7dbad54ae5 audioconvert: donot return errors in the volume ramp setparams
Also avoid the divide by zero while generating sequence.
2023-04-05 16:27:48 +05:30
Wim Taymans
d41d8cf983 audioconvert: fix return values
Return negative error numbers for errors.
2023-04-03 21:34:10 +02:00
Ashok Sidipotu
dcec2e785e audioconvert: add a invalid value for scale
The invalid value here is zero, this will help avoid inadvertant parameter
updates and brings this on par with rest of the volume ramp parameters
2023-04-03 19:04:55 +00:00
Ashok Sidipotu
74872250e8 audioconvert: make volume ramp parameters non-sticky
This mean the volume ramp parameters will have to be issued along with volume
every time. They will not be persistant.
2023-04-03 19:04:55 +00:00
Ashok Sidipotu
737bc89ab9 audioconvert: grow the volume ramp buffer
Grow the volume ramp sequence command buffer dynamically, if needed.
2023-04-03 19:04:55 +00:00
Ashok Sidipotu
8bfafaeca2 audioconvert: add support of volume ramp scale parameter
- Add support for Linear and Cubic volume scales
- Also start treating a "zero" value of volume ramp parameters as invalid
2023-04-03 19:04:55 +00:00
Ashok Sidipotu
b0f6c4a8c0 audioconvert: add support for volume ramp time params 2023-04-03 19:04:55 +00:00
Ashok Sidipotu
40cf237eb3 audioconvert: add volume ramp parameters
Add volume ramp parameters and the add ramp up and down funtions which get
triggered on volume change.
2023-04-03 19:04:55 +00:00
Ashok Sidipotu
3b1ce6c268 audioconvert: parameterize channelmix_process_control() function
Decouple the function from control port and parameterize it, so that it can be
called any spa pod sequence.
2023-04-03 19:04:55 +00:00
Wim Taymans
d07e1b5641 audioconvert: disable upmix by default again
But instead ship config override files to enable it again.

The idea is that distros can make extra packages that can than be
installed to enable the upmixing.

Also ship a config file to enable more samplerates.

Fixes #3081
2023-03-22 15:21:55 +01:00
Wim Taymans
689184a5e7 audioconvert: check return value of pod parse 2023-03-16 12:33:08 +01:00