Commit graph

2589 commits

Author SHA1 Message Date
Barnabás Pőcze
ee0963b68e spa: alsa: change index type
The `card` structure uses `uint32_t` for its index member,
on the other hand, the `state` structure uses `int`. No code
depends on it being `int`, therefore change it to `uint32_t`
for consistency.
2021-12-20 19:50:57 +01:00
Wim Taymans
f8cdc05720 alsa: allow multi-rate by default
We don't enable multiple rates by default and kernel 5.16 will fix
most issues so allow multiple rates per card.

See #1916
2021-12-18 08:33:34 +01:00
Wim Taymans
b476d6b503 alsa: add api.alsa.period-num param
To configure the amount of periods. By default we use as many as
possible but it is now possible to force a value.

See #1473
2021-12-17 16:09:52 +01:00
Wim Taymans
8630b8846c alsa: use position duration as period size
Use half of the configured quantum as the period size in batch mode.
This gives lower latency for USB devices depending on the quantum.
2021-12-17 16:08:08 +01:00
Wim Taymans
68cd9ac738 alsa: only use graph rate when nothing else is fixed
Only fall back to suggest the graph rate when we don't have a forced
rate or the card was not already in a format.

See #1892
2021-12-16 15:32:36 +01:00
Wim Taymans
7ef2b27376 acp: sync with pulseaudio
Include the alsa-ucm fixes.

See #1849
2021-12-16 15:07:05 +01:00
Wim Taymans
d2ec680d3d spa: fix initializer for old GCC
Older gcc versions seem to require the members to appear in the
designated initializer in the order they are in the definition of
the struct when compiling C++.

Fixes #1910
2021-12-16 11:08:07 +01:00
Wim Taymans
738cbcf789 alsa: fix rate for EAC3
EAC3 needs to be opened in 4x the rate of the EAC3 stream, which can be
32, 44.1 or 48 KHz. Some clients already multiply but others don't.
Check here what is the case and fix it up.

Fixes #1902
2021-12-16 11:02:39 +01:00
Barnabás Pőcze
57dae3e2b3 spa: libcamera: call get() instead of fd()
libcamera commit 560f5cf998646ddc54a20dc1c7326012834d3204
renamed the `fd()` method on `SharedFD` to `get()`.

Adjust the libcamera plugin accordingly.
2021-12-14 09:52:05 +00:00
Pauli Virtanen
1e5f499ed3 bluez5: fix aptx-ll caps size
Ensure SEP exposed by Pipewire has the full aptx-LL caps also for duplex
profile.
2021-12-11 17:20:39 +02:00
Wim Taymans
d86008cf8f support: set clock name for null-audio-sink 2021-12-10 12:43:03 +01:00
Wim Taymans
88987101ca bluez5: set clock name in SCO source and sink 2021-12-10 12:36:37 +01:00
Wim Taymans
b4d33843a6 bluez5: set clock name 2021-12-10 12:31:44 +01:00
Wim Taymans
c3bf07dff1 alsa-seq: make clock name configurable 2021-12-10 12:20:08 +01:00
Wim Taymans
53352c0c81 support: add property to configure clock name
Add a clock.name property on the driver node. By default this is
clock.system.monotonic for the monotonic system clock.
2021-12-10 11:22:23 +01:00
Wim Taymans
0648297fcb alsa: make it possible to configure the clock name
When nodes are synchronized to a common clock, the clock name can
be set to the same value on the alsa nodes and no resampling will
be done.
2021-12-10 11:04:38 +01:00
Wim Taymans
3ab3157bf1 channelmix: don't use default map for mono
Keep the original channel map so that we can match the channels
properly when remixing.
2021-12-09 17:32:41 +01:00
Wim Taymans
22a210e798 channelmix: 1 channel MONO or FC should be handled the same.
They were handled the same, remove the wrong line to attempt to
make them different.
2021-12-09 17:19:22 +01:00
Wim Taymans
6b34b8c44e audioconvert: fix mono channel mix test
When we have a single MONO channel, distribute and average. Otherwise,
use the logic to do proper mixing.

Adjust the unit test accordingly.
2021-12-09 16:51:40 +01:00
Wim Taymans
ce02c7d435 channelmix: always handle 1 channel as mono
Handle 1 channel as a mono channel, which gets copied to all outputs
or gets the average of all inputs.

Fixes the case where a mono channel is handled like a FRONT channel
and then gets attenuated when mixed into left and right.
2021-12-09 16:03:32 +01:00
Michael Olbrich
f5ec830cc2 v4l2: propagate vendor and device id to the node object
When pipewire is accessed through the portal camera API then only the
camera node objects are visible for the client.
However, chromium wants to know the vendor and device ids to identify
cameras. And those properties are currently only added to the device
object.
Fix this by propagating the ids to the node object.

Fixes #1879
2021-12-09 10:20:59 +01:00
Michael Olbrich
22d668a8a0 v4l2-device: remove unused member variable device_name
This variable was introduced in the initial commit but never used.
Just remove it.
2021-12-09 10:20:59 +01:00
Quantum
8bab9a18ec Add all 32-bit packed little endian 10-bit RGB colour formats
Given that 10-bit colour is now becoming supported on Wayland, PipeWire
should be able to represent all the possible colour formats in order
for screen capture to work.

This commit adds all possible orderings of 10-bit RGB channels and 2
extra bits used for nothing or alpha in little endian to enum
spa_video_format. Note that Wayland only uses little endian for its
10-bit colour formats, and these are not the same as the big endian
formats in reverse order.
2021-12-07 11:22:04 +00:00
Wim Taymans
30a78fe2b8 alsa: improve debug
Remove the rather useless dll values.
Add the threshold
2021-12-07 12:05:49 +01:00
Wim Taymans
10e71264e7 resample: recalc rate match when out of buffers
When we don't have any input buffers, recalculate the rate match
size field so that we can know the size of the expected buffer.

We already do this when starting but it might have been done with
a different quantum.
2021-12-03 17:54:00 +01:00
Wim Taymans
97cad7284a latency: fix latency combine calculations
0 is a valid min latency so we can't use it as an unset value. Use
some large value instead and when nothing was configured, assume it
is 0.

Fixes #1839
2021-12-02 14:49:48 +01:00
Wim Taymans
401e56699d audioconvert: listen for merger and channelmix for params
List all the params of the merger and resampler.
2021-12-02 11:35:13 +01:00
Wim Taymans
5d85e85ba7 audioconvert: remove listener for resampler
When adding a listener, don't add a listener for the resampler because
it does not contribute to the result, we only listen for results from
the resampler.
2021-12-02 11:35:13 +01:00
Wim Taymans
73b5e7aec4 audioconvert: expose more config options
Use the PROP_param to list and configure additional config options.
2021-12-02 11:35:13 +01:00
Wim Taymans
385246f5a1 audioconvert: only update the arrays when valid
Only update our internal channelmap/volumes array when we actually
parsed something.
2021-12-02 11:35:13 +01:00
Wim Taymans
7b4b73ae5b channelmix: only remap volumes when we have a format
Or else we remap to 0 channels and lose all info.
2021-12-02 11:35:13 +01:00
Wim Taymans
77d66d73d1 audioadapter: return result from enum_param directly
There is no need to pass the result in an argument, just return the
value from the function.
2021-12-02 11:35:13 +01:00
Wim Taymans
57361ed0ee alsa: improve param log a bit 2021-12-02 11:35:13 +01:00
Wim Taymans
e31f9aa0f2 alsa: don't set id in PropInfo for params
The id is useless when dealing with props params, we need to use the
name of the property as the key. Also the id can clash with other ids
of other plugins.
2021-12-02 11:35:12 +01:00
Wim Taymans
e3ddcc3b19 audioadapter: also update the follower PropInfo flags
So that we can enumerate them.
2021-12-02 11:35:12 +01:00
Julian Bouzas
921a9038e1 spa: audioadapter: check if follower supports enum params before requesting them
Some follower nodes don't support all audioadapter params (For example, param
SPA_PARAM_Props is not supported by 'support.null-sink'). This change adds a
check to avoid unsuported errors when requesting a param that is not supported
by the follower.
2021-11-30 17:33:17 +00:00
Julian Bouzas
84e210ded9 spa: test: remove port EnumFormat param info
Both fakesink and fakesrc nodes don't support it.
2021-11-30 17:33:17 +00:00
Wim Taymans
befe7b13eb alsa: add position and format to props params 2021-11-30 18:19:08 +01:00
Wim Taymans
d673158db1 alsa: expose all config options as params
Add PropInfo for all the params that we can configure at construct
time and also add them as PROP_params.

This way you can configure the headroom at runtime with this:

pw-cli s <id> Props '{ params = [ "api.alsa.headroom" 1024 ] }'
2021-11-30 17:43:07 +01:00
Wim Taymans
2f82661966 spa: add description to PropInfo 2021-11-30 17:40:56 +01:00
Wim Taymans
d79d2f69fb alsa: improve debug
Log the configured default_format.
2021-11-24 17:25:59 +01:00
Wim Taymans
8995129e6c alsa: refactor property parsing
Move the common property parsing to the init function.
2021-11-23 12:27:36 +01:00
Wim Taymans
25bfc9c63d alsa: refactor a bit
Make spa_alsa_close() do spa_alsa_pause() first and also clear the
format.
2021-11-23 12:20:27 +01:00
Wim Taymans
13923416e0 alsa: keep track of rate in card object
Expose the card object and always obtain one per pcm.

Keep the configured format in the card object.

Add a api.alsa.multi-rate property. When multi_rate is disabled,
only allow the last configured card rate on all PCMs.

This works around drivers that can't handle multiple samplerates
on their PCMs.

With this patch it should be mostly safe to configure multiple
sample rates in pipewire.conf

See #1547
2021-11-23 11:44:26 +01:00
Wim Taymans
f5f66d1718 alsa: free card on error 2021-11-17 12:55:51 +01:00
Wim Taymans
947ee152d3 bluez: check dbus service before enumerating objects
First check if the bluez dbus service is active before doing a
GetManagedObjects() call.

Else we might try to activate the bluetooth dbus service, which
should normally only be activated during bootup.
2021-11-17 12:00:00 +01:00
Wim Taymans
7eee45ff41 alsa: remove stray log line 2021-11-17 10:52:43 +01:00
Wim Taymans
f10b872733 resample: improve buffer size calculations
Scale the buffer size with the rate conversion ratio. Also make sure
that we can at least produce a maximum quantum of samples.

If we have large upconversion (8KH -> 48KHz) and small input
buffers, we would not allocate enough space for the output buffer
and cause xruns in the sink.

Fixes #1809
2021-11-16 11:48:02 +01:00
Wim Taymans
263adb45f4 audioconvert: fix compilation on armv7 2021-11-11 11:21:07 +01:00
Wim Taymans
b75796054c spa: include dict.h
It causes a compiler warning on armv7
2021-11-11 10:59:23 +01:00