Commit graph

6746 commits

Author SHA1 Message Date
Wim Taymans
8132c4e2b4 acp: add fallback alibpref just in case
Until we are sure that everybody has a recent enough version of
alsa-lib 1.2.5
2021-06-07 13:04:03 +02:00
Wim Taymans
1f85d06317 module-adapter: clear bound-resource when destroyed
So that we don't reference it anymore or try to remove the listener.
2021-06-07 12:57:09 +02:00
Barnabás Pőcze
b6c6a21747 pipewire: module-adapter: remove resource listener
Unregister the resource listener when the node is going
away to avoid use-after-free issues.

Fixes #1276
2021-06-07 10:54:19 +00:00
Barnabás Pőcze
bec615971c spa: utils: hook: use tab 2021-06-07 10:54:19 +00:00
Wim Taymans
16674a07a5 logger: improve formatting
Make enough room for the timestamp to include the last ]
Add a space before the actual log line.
2021-06-07 12:52:21 +02:00
Peter Hutterer
83f8a2896f alsa-mixer: drop the VALGRIND_HAVE_MEMCHECK hacks
Cause for this was a missing ioctl, fixed in 2014. See valgrind commit
4ef60ef1029e6933773b7de9966ece7185129d84
2021-06-07 10:44:27 +00:00
Peter Hutterer
b6e27822e5 pipewire: use RUNNING_ON_VALGRIND to determine if we're in valgrind
This removes the use of the VALGRIND environment variable
2021-06-07 10:44:27 +00:00
Peter Hutterer
d9cc1a25f1 Include the valgrind headers in our tree
These headers are designed for including in the project. So the user doesn't
need to install valgrind-devel and we don't have to worry about whether the
headers are available or not.
2021-06-07 10:44:27 +00:00
Peter Hutterer
d08d989412 spa: add a test for missing includes
For each header in the spa directory, generate a compilation test that
includes just that header. This way we can pick up missing #includes.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-06-07 10:31:17 +00:00
Peter Hutterer
6499f96396 spa: add missing #includes 2021-06-07 10:31:17 +00:00
Peter Hutterer
c049689884 logger: set linebuffering for the log
Set this once during setup so we don't have to remember to call fflush() after
each logging operation.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-06-07 10:29:36 +00:00
Peter Hutterer
1c083a6d69 logger: clamp the log time to 5 digits
In the interested of making the logs narrower, let's drop some digits from the
clock_gettime() seconds value. Clamping to 5 digigts, this gives us just under
28h before we wrap which is likely good enough for debugging.
2021-06-07 10:29:36 +00:00
Peter Hutterer
9737d6e3da logger: align debug messages better
Taken from https://gitlab.freedesktop.org/pipewire/pipewire/-/merge_requests/655#note_912691
2021-06-07 10:29:36 +00:00
Peter Hutterer
1a710cad3c logger: reduce the number of appending snprintf calls
Write the timestamp and location into a temporary buffer, then include them in
the message print. This makes bugs involving size vs length less likely and
provides a fixed limit for how much space the filename can take in the
message.
2021-06-07 10:29:36 +00:00
Wim Taymans
b142e7f09f jack: stop freewheeling correctly
Setting a NULL value for the property will remove the property and
will thus not send an update to the server and will thus not stop
freewheeling. Use "" to remove ourselves from the freewheel group
instead of looping forever.

See #1265
2021-06-07 12:22:47 +02:00
Wim Taymans
9a90030596 pw-cli: fix command parsing after pw_split changes
Don't assume anything about the way the split function maintain the
state.
2021-06-07 11:17:45 +02:00
Wim Taymans
0792c690c2 jack: schedule port latency update from main thread
Ardour does the port latency update from the process thread. Schedule
an update on the main thread in all cases to avoid deadlocks.

See #1265
2021-06-07 11:16:24 +02:00
Peter Hutterer
db989d851d spa: auto-generate the cpp compilation test
Replace the manually maintained header list with a Python script that finds
all header files and includes them in order. This adds another 25 or so
previously headers to the C++ compilation tests.
2021-06-07 07:20:21 +00:00
Peter Hutterer
fb75367975 spa: add a missing include
../spa/include/spa/node/node.h:639:14: error: ‘ENOTSUP’ was not declared in this scope
2021-06-07 07:20:21 +00:00
Peter Hutterer
48eadac1f1 logger: switch snprintf to spa_snprintf
The two are functionally equivalent, but spa_snprintf never returns a value
higher than the size, preventing memory corruption where our input string
exceeds the target buffer size (see c851349f1).

Niche case: we can no longer differ between real overflow and fitting an
N-byte string into an N+1 sized buffer, we now get a "...truncated" message
now for log messages of exactly 999 bytes long.
2021-06-07 15:37:51 +10:00
Peter Hutterer
47c173c83f spa/util: add spa_scnprintf to use over snprintf
Wraps the glibc snprintf/vsnprintf calls, but aborts if given a negative size
and zero-terminates the buffer on error.

The returned value is clipped to size - 1 which avoids issues like the one
fixed in c851349f17.
2021-06-07 15:16:35 +10:00
Wim Taymans
5a054cfc9e jack: call pw_ methods from within the lock
We're using a thread loop so always call methods with the lock or
we might cause lockups and crashes.

See #1265
2021-06-05 20:17:37 +02:00
Arun Raghavan
08daf3f4f4 pulse-server: Add a module-echo-cancel
Fairly straightforwad module to load libpipewire-module-echo-cancel
2021-06-05 17:54:02 +00:00
Huang-Huang Bao
8c42e6aecb alsa,bluez5: handle SPA_PARAM_Latency in port_set_param
Simply return 0 instead of -ENOENT.

Fixes #1262
2021-06-05 17:52:40 +00:00
Huang-Huang Bao
d3fcc0a37a bluez5: correct parameter names in spa_bt_sco_io_create declaration
From its definition and parameters passed to its function call, the 3rd parameter
is read_mtu and the 4th is write_mtu.

Fixes #1256
2021-06-05 15:17:10 +00:00
Barnabás Pőcze
4e5b20b1f5 meson.build: add devenv
Add meson devenv with the appropriate env variables
set up. Largely based on pw-uninstalled.sh
2021-06-05 15:49:17 +02:00
Barnabás Pőcze
b433a6920f pw-uninstalled: override ALSA_PLUGIN_DIR 2021-06-04 21:33:00 +02:00
Barnabás Pőcze
afd92a4272 pw-uninstalled: remove pipewire-pulse from library path
The library has been replaced by a PulseAudio server
reimplementation.
2021-06-04 21:33:00 +02:00
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