Commit graph

6568 commits

Author SHA1 Message Date
Wim Taymans 431bcb6805 pw-uninstalled: set PKG_CONFIG_PATH 2021-06-04 13:53:57 +02:00
Wim Taymans a2cb5f3394 properties: try to keep full doxygen docs out of headers
Try to keep the full docs out of the headers and into the .c file.
A small short blurb in the header is enough for quick lookups.
Also try to use a regular comment to not confuse the doc system.
2021-06-04 12:08:23 +02:00
Peter Hutterer 2e6621fae0 daemon: use getenv(PIPEWIRE_CORE) for the core.name if it exists
As documented in pipewire/keys.h, PIPEWIRE_CORE is supposed to overwrite the
default value.
2021-06-04 08:58:18 +00:00
Peter Hutterer f775547528 pipewire: merge, not overwrite the context.properties from the config file
Any values already set in the properties list (e.g. from earlier getenv())
calls should not be overwritten by the value in the config file.
2021-06-04 08:58:18 +00:00
Peter Hutterer b179e81070 pipewire: add pw_properties_add_string()
Equivalent to the existing pw_properties_update_string() but only adds new
properties from the given string, it doesn't overwrite existing ones.
2021-06-04 08:58:18 +00:00
Peter Hutterer 81cc466752 spa: the cpp test is a compilation test only
No point installing or even running it, we don't do anything here.
2021-06-04 18:46:29 +10:00
Peter Hutterer a71e68e945 spa: add missing header guards and extern C define for spa/pod/filter.h 2021-06-04 18:46:29 +10:00
Peter Hutterer a179e0fecd spa: fix a C++ typecast warning
void* cannot be automatically type-casted so let's do this explicitly.

../spa/include/spa/param/latency-utils.h: In function ‘spa_pod* spa_latency_build(spa_pod_builder*, uint32_t, const spa_latency_info*)’:
../spa/include/spa/pod/builder.h:651:1: error: invalid conversion from ‘void*’ to ‘spa_pod*’ [-fpermissive]
2021-06-04 17:57:11 +10:00
Peter Hutterer 3332e271be spa: fix compiler warnings about missing braces in initializer
First element is a spa_list, so {{0}} it is.

../spa/include/spa/node/utils.h:98:40: warning: missing braces around initializer for ‘spa_list’ [-Wmissing-braces]
   98 |         struct spa_hook listener = { 0 };
2021-06-04 17:57:11 +10:00
Peter Hutterer 98503a84b3 spa: fix an C++ invalid type conversion
In file included from spa/tests/test-cpp.cpp:49:
../spa/include/spa/param/latency-utils.h: In function ‘int spa_latency_parse(const spa_pod*, spa_latency_info*)’:
../spa/include/spa/param/latency-utils.h:95:25: error: invalid conversion from ‘int’ to ‘spa_direction’ [-fpermissive]
   95 |         info->direction &= 1;
      |         ~~~~~~~~~~~~~~~~^~~~
      |                         |
      |                         int
2021-06-04 17:57:10 +10:00
Wim Taymans 2a8b7594bc pulse-server: avoid overflow
Make sure the requested bytes never go below 0.

See #1258
2021-06-04 09:13:43 +02:00
Barnabás Pőcze e65afe8fa2 pulse-server: module-combine-sink: remove hooks
Remove hooks when the module is unloaded to avoid
use-after-free issues. Remove the cleanup source as well.

Fixes #1259.
2021-06-04 06:55:08 +00:00
Peter Hutterer 4cb87317a7 pipewire: assert a nonzero array allocation size
If pw_array_ensure_size() is called on an array that has not been initialized
with an extend, assert. Otherwise we get stuck in an infinite loop since
doubling our zero allocation size will never reach "need".
2021-06-04 09:00:34 +10:00
Wim Taymans 0ba9402d4b Revert "media-session: use direction to find the node by name"
This reverts commit b0068fd46b.

It breaks recording from monitor ports.
2021-06-03 20:33:59 +02:00
Wim Taymans 669fbf10c1 fix some leaks in error paths 2021-06-03 20:33:59 +02:00
Barnabás Pőcze 6affda9424 pipewire: utils: add more tests for pw_split_walk() 2021-06-03 17:23:42 +02:00
Barnabás Pőcze 3b681f2138 pipewire: utils: pw_split_walk(): skip leading runs of chars in delimiter
Previously, if the string started with any of the characters in
delimiter, the first returned string would've been an empty string.
This is in contrast with the fact that otherwise `pw_split_walk()`
skips empty fields.

E.g.

  "::field1::field2" with ":" as `delimiter`

would have resulted in
 *  ""
 *  "field1"
 *  "field2".

Adjust the function to skip leading runs of characters in `delimiter`
by calling `strspn()` first.
2021-06-03 17:06:16 +02:00
Barnabás Pőcze 576513583b pipewire: impl-module: limit module search depth
Limit the depth of the recursive search done by `find_module()`
to a sensible amount (at the moment: 8).
2021-06-03 17:06:16 +02:00
Barnabás Pőcze a8428a57b1 pipewire: impl-module: simplify module dir handling logic
Since `pw_split_walk()` does not skip leading runs of
delimiters, if `module_dir` is an absolute path, then

  l = pw_split_strv(module_dir, "/", 0, &n_paths);

will return an array of one element, which is exactly the same
as `module_dir`, `strcmp(l[0], module_dir) == 0`.

If `module_dir` is a relative path, then the returned array
still contains a single element, which is, again, the same
as `module_dir`.

Therefore, omit the the call to `pw_split_strv()` and simply
use `module_dir` as is.
2021-06-03 17:06:16 +02:00
Barnabás Pőcze 0f03109cb6 Makefile: remove trailing slashes from env variables 2021-06-03 17:06:16 +02:00
George Kiagiadakis 131832d441 pulse-server: suffix TAG_USEC constants with LL, as they must be 64-bit
Fixes protocol errors on arm
2021-06-03 17:36:19 +03:00
Wim Taymans 1b484867eb 0.3.29 2021-06-03 12:01:53 +02:00
Wim Taymans 3fcb9c44ef spa: use strtoull for atou32
On machines with a 32 bits long, converting a negative value will
still result in  v == (uint32_t)v and the unit test will fail.
Extend to 64 bits and strtoull to reject negative values in atou32.
2021-06-03 11:40:27 +02:00
Wim Taymans 0b0a4897d6 spa: use unsigned long for strtoul result 2021-06-03 11:18:57 +02:00
Wim Taymans 6971d11901 pw-cat: support u8 format as well 2021-06-03 10:10:18 +02:00
Peter Hutterer 8b98d111e1 context: print the correct strerror if the config load failed
"can't load config client.conf: Success" is a bit confusing otherwise.
2021-06-03 09:51:34 +02:00
Peter Hutterer 4d45182801 spa: add SPA_FOR_EACH_ELEMENT for array traversal 2021-06-03 07:25:32 +00:00
Reynaldo H. Verdejo Pinochet 5a69a04cfe INSTALL: pass build dir to uninstalled script
The instructions were left a bit broken by
d068cc2bcf because the unistalled script uses
"build" as default and will fail with an "invalid
build directory" error for people following the
guide step-by-step and using "builddir" instead.
2021-06-03 07:25:01 +00:00
Huang-Huang Bao c7cac40e03 bluez5: init node soft volumes to 1.0f 2021-06-03 07:17:41 +00:00
Huang-Huang Bao f92a5b3bbd bluez5: emit node volume and mute right after bluez5 node creating
bluez5 nodes will always be removed & created again during profile changing, hence
node volume & mute will always be reset. This is OK if profile did changed, because
session manager would carries volume & mute to bluez5 route param. But if profile
was not changed after setting profile (a2dp-sink-sbc -> a2dp-sink -> a2dp-sink-sbc),
session manager would think node volume & mute are not changed and no route
setting is performed, causing route volume out of sync with node volume.

To fix this, we emit node volume and mute right after bluez5 node is created.

Fixes #1254
2021-06-03 07:17:41 +00:00
Huang-Huang Bao 27433c4000 bluez5: clean up node volume emitting
The problem described in previous 'volume_changed()' has been fixed
in 5bf2144438, hence we don't need
that workaround anymore.
2021-06-03 07:17:41 +00:00
Arun Raghavan d2d0375c39 module-echo-cancel: Change extension .cc to .cpp for aec-webrtc
Makes this consistent with the rest of the code base.
2021-06-02 18:26:19 -04:00
Arun Raghavan d95870d8d3 module-echo-cancel: Wire up the webrtc echo canceller
Mostly uses the existing infrastructure, but the webrtc canceller has a
fixed blocksize, so we:

  1. Use the canceller blocksize if configured
  2. Accumulate output data in a ringbuffer
  3. Push out the data in the required chunk size
2021-06-02 17:56:40 -04:00
Arun Raghavan 1349d5334d module-echo-cancel: Drop buffers on overruns
Without this, if we do overrun, we'll never catch this.
2021-06-02 12:50:16 -04:00
Arun Raghavan bbae1adda0 module-echo-cancel: Separate input gathering and output processing
This aggregates buffers from the capture stream and the sink in the
corresponding process callbacks, and runs processing based on the
desired resampler rate if there is one.

We allow the ringbuffer in which we capture buffers to grow to some
extent, as that seems to be required for playback to occur smoothly.
Whether this is hiding some other underlying problem likely needs
investigation.
2021-06-02 12:46:12 -04:00
Arun Raghavan 42196a331d module-echo-cancel: Consolidate includes 2021-06-02 12:46:12 -04:00
Wim Taymans 35e81fbfdc alsa: rework UCM open
Use _alibpref to check if a device needs a UCM local config. Mark
the device as such and use this to set the OPEN_UCM property on
the device.
Open the UCM for a card when the device has the property set. Use the
same logic for loading the UCM as the acp code.

See #1251
2021-06-02 17:25:21 +02:00
Wim Taymans 58d0e44664 pipewire: Add option to disable config files
Add env variable PIPEWIRE_NO_CONFIG to disable parsing
custom config files.
Add a method to check extra options.
Expose valgrind, no-config and no-color as options.
2021-06-02 15:55:24 +02:00
Wim Taymans dde03a7dd3 config: add some comments in the config file
About where to copy and change it.
2021-06-02 15:22:49 +02:00
Wim Taymans e3d3f04780 alsa: if we are passed a UCM device, make sure to open UCM
UCM devices can require local data from use_case_mgr_open() but since
we do that in a separate process, make sure we reopen the use case
manager in case we are passed a UCM device so that the config is
available.

See #1251
2021-06-02 13:23:08 +02:00
Peter Hutterer 1d4b24d02b pipewire: allow NULL pointers in pw_memmap_free()
Just like the real free() we should just ignore a NULL pointer, makes the
caller code easier for those instances where properties are optional.
2021-06-02 10:56:46 +00:00
Peter Hutterer 71e0cfb5fa pipewire: allow NULL pointers in pw_free_strv()
Just like the real free() we should just ignore a NULL pointer, makes the
caller code easier for those instances where properties are optional.
2021-06-02 10:56:46 +00:00
Peter Hutterer e0471c6757 pipewire: allow NULL pointers in pw_properties_free()
Just like the real free() we should just ignore a NULL pointer, makes the
caller code easier for those instances where properties are optional.

Patch generated with concinelle with a few manual fixes.
2021-06-02 10:56:46 +00:00
Peter Hutterer a1e821c259 pw-dump: use the spa_ato* helpers for string to number conversions 2021-06-02 07:39:41 +00:00
Peter Hutterer 3796bc814e pipewire: use spa_ato*() to parse properties
For boolean properties:
- passing in NULL no longer crashes and instead returns false
- passing in a string starting with 1 (e.g. "1xyz") no longer resolves to true

For int-based properties:
- passing in NULL no longer crashes and instead returns 0
- passing in invalid numbers no longer resolves to whatever number prefix
  could be parsed (e.g. "123foo" was 123)
2021-06-02 07:39:41 +00:00
Peter Hutterer 6826df07da spa/utils: add spa_atou32, spa_atoi64,spa_atou64, spa_atod, spa_atof
Same as the existing spa_atoi32 but for uint32_t, {u}int64_t, float and
double.
2021-06-02 07:39:41 +00:00
Peter Hutterer c3ab4ec9dc spa: fix documentation for spa_atoi32
The val isn't undefined on failure, it's unmodified.
2021-06-02 07:39:41 +00:00
Peter Hutterer 1a5faa7b52 spa: add a header for ANSI color sequences
Makes the code more readable and guarantees we use the same sequences for the
same colors everywhere.
2021-06-02 14:17:29 +10:00
Barnabás Pőcze 4c13eced55 pulse-server: detach clients from server
When the server or client goes away, detach the client
from the server to avoid potential use-after-free issues
that might occur if the client causes the
unloading of the server it is connected to.

E.g.:

  pactl load-module module-protocol-native-tcp port=4713
  pactl -s localhost:4713 unload-module module-native-protocol-tcp

See #1240.
2021-06-01 22:11:49 +02:00
Wim Taymans 3889ea5277 pulse-server: add ref to client while processing
Add a ref to the client while processing messages. This way we don't
destroy the client if we destroy the server it is on.

Fixes #1240
2021-06-01 17:48:24 +02:00