Commit graph

8298 commits

Author SHA1 Message Date
Barnabás Pőcze
5db2c6cc32 pulse-server: simplify a condition
`a || (!a && b)` equals `a || b` due to the
short-circuiting nature of `||` and `&&`.
2022-02-02 15:40:43 +00:00
Barnabás Pőcze
6d0075b4e9 pulse-server: client: cancel related work queue jobs 2022-02-02 15:40:43 +00:00
Barnabás Pőcze
78aaa0a3dd pulse-server: client: move to cleanup list on detach
Move a client to the `impl->cleanup_clients` list right
after it has been removed its server's `clients` list.
2022-02-02 15:40:43 +00:00
Barnabás Pőcze
d2edb1ab16 pulse-server: client: do not leave dangling pointers behind 2022-02-02 15:40:43 +00:00
Wim Taymans
f38837d9e2 conf: look in conf.d directories and merge all sections
Load all sections found in all prefix/name.conf.d directories and add
them to the config as overrides.
If for example jack.conf is loaded, check in:

  /usr/share/pipewire/jack.conf.d/
  /etc/pipewire/jack.conf.d/
  $XDG_CONFIG_HOME/pipewire/jack.conf.d/
     or ~/.config/pipewire/jack.conf.d/

For .conf files and also process the sections. The files are processed
in sorted order so 10-remap.conf can be used to specify the order.

When processing a section, first the global conf is applied and then the
overrides in their order.

This makes it possible to override properties or add modules,
objects and custom matching rules.

Since the merging logic is handled either internally or by the
application, we can add more syntax later to do more complex merges.

See #207
2022-02-02 14:58:15 +01:00
Wim Taymans
92e851f61b conf: improve debug 2022-02-02 12:41:36 +01:00
Wim Taymans
58ebe0f88a conf: Parse the whole config with properties
There is no need to call the callbacks when reading the config file,
just store all properties.
We're only going to extract one when iterating later.
2022-02-02 12:37:49 +01:00
Wim Taymans
9bac90882d test: disable broken test
When a prefix is given, the file should not be found.
2022-02-01 18:15:16 +01:00
Wim Taymans
f273e2a716 conf: emit callback for config sections
Instead of reading all config section in properties, emit a callback
for each section, allow for filtering on a particular section as
well. In the callback, update the section value in the properties.

Deprecate get_conf_section(), it can't support multiple section
updates.
2022-02-01 17:16:33 +01:00
Wim Taymans
5839400aa0 context: implement prop updates with for_each 2022-02-01 16:51:59 +01:00
Wim Taymans
432f464297 conf: implement match rules with conf_section_for_each 2022-02-01 16:35:16 +01:00
Wim Taymans
0ac87a14cd context: move context method to right header file. 2022-02-01 16:30:43 +01:00
Wim Taymans
d6218b65ab conf: parse the context sections with iterator
Make a new function that calls a callback for each config section
and use that to parse the config sections internally.
2022-02-01 16:27:21 +01:00
Wim Taymans
50de4b1886 conf: add some properties in the conf
Add the path, prefix and name in the config properties.
2022-02-01 15:55:17 +01:00
Wim Taymans
2b569861b1 conf: refactor path generation
Make different methods for the different paths to search.
2022-02-01 15:37:48 +01:00
Wim Taymans
2013fb56cf conf: refactor abs path
We can simplify the check by shifting the prefix and name and use
the same code for both the config and state path.
2022-02-01 15:25:48 +01:00
Wim Taymans
65c487564b context: add a function to merge config properties
Add a function that takes a section and merges the properties into
a target properties. Replace some usage of get_config_section().
2022-02-01 15:11:45 +01:00
Wim Taymans
6149c01b51 jack: pass size_t as len 2022-02-01 13:28:10 +01:00
Pauli Virtanen
f32935ec8a bluez5: sco-sink: fix behavior as follower
When sink is follower, and no data to write is available, it should not
schedule a timeout, but wait for the driver to wake it up again.

Fixes process ending up busylooping in data thread as follower, under
some conditions.

Also, clean up the code to be more clear about timeout logic. Just loop
directly instead of setting timeout 1, if we need to just flush more
immediately.
2022-01-31 21:59:39 +02:00
Pauli Virtanen
4bb3ff739a bluez5: keepalive A2DP source / SCO AG dynamic node transports
When acting as SCO AG / A2DP sink, the remote end should decide when to
close the connection.  This does not work currently properly, because
stopping sources/sinks releases the transport, which causes it to go
idle, and which then destroys dynamic nodes.  The sources/sinks should
not cause the transport to be released.

Implement keepalive flag for spa_bt_transport, such that
spa_bt_transport_release does not actually release the transport when
the refcount reaches zero. Set the flag for dynamic nodes when the
transport becomes pending (remote end connects) and unset the flag when
idle (remote end disconnected, or dynamic node removed).
2022-01-31 21:59:39 +02:00
Wim Taymans
24c97b1c7e context: add force-quantum and force-rate property
Add a node.force-quantum and node.force-rate property. When no global
quantum or rate is enforce with settings, the last updated node property
is used as the quantum.

Make jack use the force-quantum property when set_buffersize is used to
make sure that the quantum is not just a suggestion but a hard forced
one. This makes it possible for ardour or other jack apps to raise the
quantum above the max-quantum but also ensure that it will not change
by any other application (unless other jack apps).

Fixes #2079
2022-01-31 17:59:18 +01:00
Wim Taymans
54d50b943f global: move serial counter to context 2022-01-31 17:34:30 +01:00
Wim Taymans
8698d5a548 jack: handle metadata remove
Add a proxy listener to the metadata so that we can remove our ref to it
when it is destroyed.
2022-01-31 15:04:08 +01:00
Wim Taymans
dbab29d9db pulse-server: improve remap sink/source properties
Make the NODE_DESCRIPTION based on target sink or node.name
2022-01-31 12:40:38 +01:00
Wim Taymans
7ec920b0af pulse-server: improve remap sink/source properties
Make the same MEDIA_NAME and NODE_DESCRIPTION for both streams.
Make a better NODE_NAME for the other stream with a prefix.
2022-01-31 12:07:49 +01:00
Pauli Virtanen
a2a5012cb2 bluez5: backend-native: set transport volume on create
Initial transport volume was being set incorrectly to max for new
transports. This is usually masked by route restore, but not always.
2022-01-30 22:00:32 +02:00
Pauli Virtanen
3ffc0452a7 bluez5: backend-native: fallback switch msbc->cvsd on EOPNOTSUPP
If MSBC connect() fails with EOPNOTSUPP, trigger codec renegotiation.

When PW is AG, this also removes the msbc profile.
2022-01-30 22:00:32 +02:00
Pauli Virtanen
1da23145df bluez5: probe adapter msbc capability via hci commands
Using a probe connection to determine adapter msbc capability causes
problems on some adapters (ff8c3d2, 84bc0490a5, 717004334b,
pipewire#2030) and seems to be a bad idea.

Go back to probing for transparent msbc transport capability via HCI
commands. bluetooth/hci.h may be deprecated later, but for now it's
better to go back to using it.  (In practice, adapters not supporting
esco appear to be fairly rare; kernel commit in 2013 refers to "older
devices", so if we can't use HCI, assume the adapter supports the
necessary modes.)
2022-01-30 22:00:32 +02:00
Valentin Hăloiu
483831e514
bluez: handle non-hexadecimal XAPL version strings 2022-01-29 21:13:45 +00:00
Wim Taymans
115875dc5b pulse-server: add more properties
Add device.class property
2022-01-29 11:21:31 +01:00
Wim Taymans
78ff44b91d pulse-server: fill description for remap module
See #2076
2022-01-29 11:11:44 +01:00
Bart Ribbers
b3394f36b9 ci: add Alpine target to test Musl builds 2022-01-29 07:29:34 +00:00
Wim Taymans
7201b079fc meson: reverse intl check
If we have a library, use that, otherwise use the normal dep.

Might fix build on musl
2022-01-29 08:28:15 +01:00
Wim Taymans
6543899fe6 pulse-server: implement stream_buffer_attr 2022-01-28 17:34:36 +01:00
Wim Taymans
ce03fc7c15 pulse-server: increase maxlength to match tlength
When we need to increase tlength because of a quantum change, increase
maxlength as well, but clamp it to MAXLENGTH.

See #2069
2022-01-28 16:23:42 +01:00
Wim Taymans
1ac1f914e3 pulse-server: allows allocate MAXLENGTH for the ringbuffer
See #2069
2022-01-28 16:21:03 +01:00
Wim Taymans
5ead4507cc pulse-server: ensure tlength <= maxlength
See #2069
2022-01-28 16:15:26 +01:00
Wim Taymans
ead827d6cb modules: limit the max amount of items in the protocol
For now, put a limit on the amount of items we can send and receive
over the native protocol. A more complex way of allocating and freeing
can be implemented later when we really need to raise the limits.

Fixes #2070
2022-01-28 15:55:44 +01:00
Wim Taymans
92198e4d0d spa: clamp required alignment to cpu alignment
pipewire will allocate buffers aligned to the max alignment required for
the CPU. Take this into account and don't expect larger alignment.

Fixes a warning in mixer-dsp when the CPU max alignment is 16 but the
plugin requires 32 bytes alignment for the AVX2 path (that would never
be chosen on the CPU).

See #2074
2022-01-28 11:49:06 +01:00
Wim Taymans
36d78c41a0 modules: refactor permissions parsing 2022-01-28 10:51:09 +01:00
Wim Taymans
98aa2a04c7 modules: refactor param_info_parsing
To add more checks later.

See #2070
2022-01-28 10:35:14 +01:00
Wim Taymans
ef8fa3dc6f modules: refactory param parsing
So that we can add some more checks later.

See #2070
2022-01-28 10:25:30 +01:00
Wim Taymans
71a86877b7 modules: refactor parse_dict
Make a macro from parse_dict and move the n_items parsing and alloca
in it. This should make it easier to check the data.

See #2070
2022-01-28 10:01:12 +01:00
Maciek Borzecki
78a239a370 spa/bluez: enable sbc-xq for JBL Endurance Run BT headset
Enable SBC-XQ codec for the JBL Endurance RUN BT headset. The codec worked well
with pulseaudio and works equally well with pipewire.

Signed-off-by: Maciek Borzecki <maciek.borzecki@gmail.com>
2022-01-28 07:58:22 +00:00
Peter Hutterer
6bd1bec2a4 ci: test with all auto() features enabled
This should catch any potential issues with conflicting options, missing
libraries, etc.

We need to disable aptx and roc because Fedora doesn't ship those
libraries, and we disable libcamera because it's a moving target and
shouldn't hold up the pipeline.
2022-01-28 10:45:11 +10:00
Wim Taymans
fd1112c4e2 modules: add latency and rate params to protocol-simple
See #2068
2022-01-27 16:56:22 +01:00
Wim Taymans
ee007eaf6c modules: improve simple-protocol arguments
Use the format parsing code to also parse the channel_map.
Improve serialization of the properties.

See #2068
2022-01-27 16:31:01 +01:00
Wim Taymans
0ba5aebf0b mem: add debug for new fd 2022-01-27 15:08:44 +01:00
Wim Taymans
5ab031b472 loop: remove the eventfd to stop the loop
We can just as well use _invoke to schedule a task in the context
of the loop.
2022-01-27 15:07:38 +01:00
Wim Taymans
3256c6e5e7 tools: fix compilation with musl 2022-01-27 14:59:11 +01:00