Commit graph

6929 commits

Author SHA1 Message Date
Peter Hutterer
731888fcdd test: fix a memleak in the config tests
Fixes bba9edabee
2021-07-07 11:03:23 +00:00
Peter Hutterer
4f49e893c1 test: init the pod test buffer with a fixed value
Works around the valgrind complaints when we call spa_debug_mem() on the
buffer with various sizes.
2021-07-07 11:03:23 +00:00
Peter Hutterer
5ebfbccd16 pwtest: if a test expects a signal, skip it under valgrind
Running under valgrind enforces --no-fork so any signal will cause valgrind
to error out, failing the test abnormally. This prevents us from running
our test suite through valgrind, we'd have to mark every test specifically
whether it should run under valgrind or not.

Easier is just to automatically skip tests expecting signals.
2021-07-07 11:03:23 +00:00
Wim Taymans
6600d93d5d impl-link: improve feedback loop check
Mark peer nodes as visited and only visit them once. Reduces the
complexity a lot.
Limit the number of hops we check to 32 to avoid excessive work.
2021-07-07 12:54:09 +02:00
Jonas Holmberg
298dfa7da4 pipewire: make pw_get_prgname() thread safe
Make sure the string isn't overwritten while another thread is reading
it.

Fixes #1402
2021-07-06 19:29:16 +02:00
Wim Taymans
8184d4576a handle snprintf errors better 2021-07-06 17:56:04 +02:00
Wim Taymans
99b1ce96ed jack: avoid overflow in time calculations 2021-07-06 17:55:38 +02:00
Wim Taymans
d88e8edd11 avoid shadowing arguments 2021-07-06 17:55:16 +02:00
Wim Taymans
91f4e4d3c8 alsa: catch and handle some more errors 2021-07-06 17:54:08 +02:00
Wim Taymans
acad6b8f2b audioconvert: use the right variable
Keep the result of the follower in res2, fail if we could not set the
properties on both the follower and the converter.
2021-07-06 16:28:57 +02:00
Wim Taymans
9fa72f22cb thread: fix compilation 2021-07-06 16:20:05 +02:00
Wim Taymans
27fc430eff po: update russian
Fixes  #1374
2021-07-06 16:02:50 +02:00
Wim Taymans
1ff535e6eb spa: move thread to SPA support
It can be more generally useful eventually.
2021-07-06 15:48:20 +02:00
Wim Taymans
3a879e8b1a audioconvert: fix s24_32 to float
s24_32 needs to be sign extended before converting to float because the
upper bits are undefined and might be anything.

Fixes #1393
2021-07-06 12:42:39 +02:00
Wim Taymans
aab72ded6e jack: emit graph callbacks as well
When a link is added and removed, emit the graph callback.
2021-07-06 10:40:31 +02:00
Wim Taymans
a3549deb48 jack: remove a lock
The thread loop is already taken when calling port_update_latency.
Improve some debug, add some comments.
2021-07-06 10:40:31 +02:00
Peter Hutterer
bba9edabee conf: don't allow a NULL config name
No functional changes, this is enforced by the only in-tree callers of
pw_conf_load_conf() but let's enforce this properly.
2021-07-06 07:14:21 +00:00
Peter Hutterer
fb2d35895e conf: ignore the prefix if the config file name is an absolute path
Fixes:
$ export PIPEWIRE_CONFIG_PREFIX=/usr/share/pipewire
$ pipewire -c /etc/pipewire/bar.conf
[W][11925.530591][          conf.c:  253 conf_load()] config 0x560039ac6510: error loading config '/usr/share/pipewire//etc/pipewire/pipewire.conf': No such file or directory
[W][11925.530721][       context.c:  178 try_load_conf()] context 0x560039ac6190: can't load config /usr/share/pipewire//etc/pipewire/pipewire.conf: No such file or directory
2021-07-06 07:14:21 +00:00
Peter Hutterer
b1ac776ff0 test: remove duplicate test invocation 2021-07-06 07:14:21 +00:00
Konstantin Kharlamov
252816f757 bluez5: fix wrongly typed started field in spa_bt_sco_io
This is a bitfield, but it's unclear what it achieves since this is the
only member of a bitfield, so it may be more efficient to just make it a
bool.

Fixes a LGTM warning:

    Bit field started of type int should have explicitly unsigned integral, explicitly signed integral, or enumeration type.
2021-07-06 00:07:21 +03:00
Konstantin Kharlamov
64352dd256 gstpipewireformat: remove useless comparison in gst_caps_from_format
Fixes a LGTM warning:

    Empty block without comment
2021-07-06 00:07:17 +03:00
Konstantin Kharlamov
8c013b8183 modules: remove useless comparison in pw_properties_from_avahi_string
It doesn't do anything, let's just get rid of it.
2021-07-05 23:57:35 +03:00
Konstantin Kharlamov
6f39e13f11 module-zeroconf-discover: factor out pw_properties_from_avahi_string
This allows to get rid of the empty if block in comparison to
channel_map, and makes it clear that the comparison is useless. So in
the next commit we will remove it.

Fixes an LGTM warning:

    Empty block without comment
2021-07-05 23:53:46 +03:00
Konstantin Kharlamov
dea1a0bee2 audiotestsrc: convert sizes to const size_t
`sizes` members participate in multiplication and subsequent assignment
into port->bpf, which has size_t. So LGTM rightfully complains, there's
a chance the multiplication will overflow before the assignment happens.

Should have no influence on performance since 64 bit multiplication is
as fast, and since the struct is constified, a wise compiler should make
sure it doesn't take excess space either.

Fixes LGTM warning:

    Multiplication result may overflow 'unsigned int' before it is converted to 'size_t'.
2021-07-05 23:30:45 +03:00
Konstantin Kharlamov
ab71d2c3cb audioconvert: fix potential NULL reference in resample_native_init
That was found by GCC fanalyze pass. Fixes warning:

    ../spa/plugins/audioconvert/resample-native.c: In function ‘resample_native_init’:
    ../spa/plugins/audioconvert/resample-native.c:385:9: warning: dereference of NULL ‘0B’ [CWE-476] [-Wanalyzer-null-dereference]
      385 |         spa_log_debug(r->log, "native %p: q:%d in:%d out:%d n_taps:%d n_phases:%d features:%08x:%08x",
2021-07-05 19:35:06 +03:00
Wim Taymans
0b758a2301 alsa-seq: fix off-by-one for event offset
The event offsets need to go from 0 to quantum-1 to be valid to the
current midi event buffer.

Fixes #1395
2021-07-05 16:25:11 +02:00
Wim Taymans
831fb9ea01 JACK: implement jack_recompute_total_latencies()
Still acts a little weird in Ardour sometimes as if ardour is not
getting the updates in time.

See #1388
2021-07-05 16:06:34 +02:00
Wim Taymans
4abcfcdfb9 improve some debug 2021-07-05 16:06:22 +02:00
Wim Taymans
c0b002689b impl-link: don't recalc latency on feedback links
Or else we might keep updating the latency in a loop.
2021-07-05 16:00:27 +02:00
Wim Taymans
dc5ed8f327 thread: add methods to get rt priority range 2021-07-05 11:35:27 +02:00
Peter Hutterer
488150fac6 modules: document roc ports to be TCP/UDP ports
Let's make this really obvious that we're not talking about a pipewire port
here.
2021-07-05 08:57:41 +00:00
Peter Hutterer
765bd417de doc: link the most recent modules as subpages
This sorts them correctly in the navigation bar
2021-07-05 08:57:41 +00:00
Peter Hutterer
d6bb69f2bd doc: add the configuration file format to the online documentation
Mostly copied from the man page but with a more applicable example.
2021-07-05 08:57:41 +00:00
Peter Hutterer
d51634a2f1 man: add --config to the pipewire man page 2021-07-05 08:57:41 +00:00
Evgeniy Khramtsov
91988acb6b utils: fix public API with consumers using _POSIX_C_SOURCE on FreeBSD
cb6dbd165a made public API incompatible with consumers using
_POSIX_SOURCE, _POSIX_C_SOURCE or _XOPEN_SOURCE: <sys/mount.h>
isn't standalone but depends on BSD-specific types in <sys/types.h>
which are hidden when POSIX compliance is requested.

xdg-desktop-portal-wlr passes -D_POSIX_C_SOURCE=200809L via meson.build
which works for its own code and all other dependencies.

In file included from ../src/core/main.c:7:
In file included from /usr/local/include/pipewire-0.3/pipewire/pipewire.h:35:
In file included from /usr/local/include/pipewire-0.3/pipewire/client.h:35:
In file included from /usr/local/include/pipewire-0.3/pipewire/proxy.h:108:
In file included from /usr/local/include/pipewire-0.3/pipewire/protocol.h:48:
In file included from /usr/local/include/pipewire-0.3/pipewire/utils.h:34:
In file included from /usr/include/sys/mount.h:38:
/usr/include/sys/ucred.h:99:2: error: unknown type name 'u_int'
        u_int   cr_version;             /* structure layout version */
        ^
In file included from ../src/core/main.c:7:
In file included from /usr/local/include/pipewire-0.3/pipewire/pipewire.h:35:
In file included from /usr/local/include/pipewire-0.3/pipewire/client.h:35:
In file included from /usr/local/include/pipewire-0.3/pipewire/proxy.h:108:
In file included from /usr/local/include/pipewire-0.3/pipewire/protocol.h:48:
In file included from /usr/local/include/pipewire-0.3/pipewire/utils.h:34:

Reported by: Jan Beich <jbeich@FreeBSD.org>
2021-07-05 08:49:14 +00:00
Wim Taymans
5e0c9199bd context: drop RT when freewheeling
When we are freewheeling, drop the RT priority so that we don't
lock up the system too much.
2021-07-05 10:41:57 +02:00
Wim Taymans
9ceb728dec jack: use the pw_thread_utils interface
Use the pw_thread_utils interface to create/join and acquire/drop
RT priority. This allows JACK apps to also use the configured module to
handle RT priorities.
2021-07-05 10:40:25 +02:00
Wim Taymans
1de16afc40 modules: use pw_thread_utils interface for module-rt*
Let the module-rt and module-rtkit provide a new pw_thread_utils
implementation.

The pw_thread_utils interface has many advantages over the old way
of boosting the thread:

1. Does not require to add a source to the loop and do priority
   boost in-thread.
2. Works on simple threads without data-loop interface.
3. Allows dropping RT priority as well.

The rtkit implementation requires a bit more work because there is
currently no pthread API to map an pthread to a tid. We make a small
wrapper thread to capture the tid with getpid() to do the mapping
ourselves. This should go when the new API arrives. See also:
(https://sourceware.org/bugzilla/show_bug.cgi?id=27880)
2021-07-05 10:26:56 +02:00
Wim Taymans
6b73d49780 data-loop: use new thread interface 2021-07-05 10:10:36 +02:00
Wim Taymans
bfa3c6c137 thread: add interface to manage threads
Add an interface to create and join threads as well as change the
priority on the threads.
2021-07-05 10:05:37 +02:00
Wim Taymans
5088ebacc5 jack: drop/acquire RT when enter/exit freewheel
Freewheel can use a lot of CPU and we don't want our realtime threads to
take up all resources while freewheeling.
2021-07-05 09:56:14 +02:00
Wim Taymans
e2d6545e77 jack: client_thread_id should return the data thread
Add a function in data-loop to get the natvive thread and use that
in client_thread_id() so that it returns the pthread of the
data thread instead of the caller thread.
2021-07-05 09:56:14 +02:00
Wim Taymans
4b9b97841d increase rt.limit from 200ms to 2seconds
200ms seems a little small, some plugins initialize themselves from the
RT thread and get killed. 2 seconds seem to be a better default.

The important part is that there is a limit so that runaway processes
are killed and don't lock up the system.

Fixes #1344
2021-07-04 21:57:54 +02:00
Haochen Tong
77318477bc keys: fix PW_KEY_AUDIO_RATE key name 2021-07-03 19:32:36 +00:00
Wim Taymans
d14c383811 pulse-server: silence UNDERFLOW warning to info
Creating underflows is standard behaviour for many clients. PulseAudio
does not warn about this so we should not either.

Fixes #910
2021-07-03 21:14:48 +02:00
Hector Martin
1c6326439f jack: make cycle_wait() loop until a valid cycle
pw_data_loop_wait() can return due to activity on another socket, so
keep looping until cycle_run() gets a valid command.

Fixes #1386
2021-07-03 16:58:20 +09:00
George Kiagiadakis
df8bd85277 alsa-ctl: filter for and use only the "default" metadata object
Fixes #1384
2021-07-02 17:44:35 +03:00
Gleb Popov
43e4625bbe Use real pthread_setname_np implementation on old FreeBSD.
pthread_setname_np differs from pthread_set_name_np in the return value, so
it is not correct to just #define one to another.
2021-07-01 17:33:45 +00:00
Wim Taymans
797e9b3e0b jack: use RESET_ON_FORK when dropping rt priority
Once we set the RESET_ON_FORK flag we might not have permission to
reset again in drop_rt so simply also set it when dropping.
2021-07-01 15:34:19 +02:00
Wim Taymans
35194d6de0 node-driver: remove timers when not a driver 2021-07-01 12:28:18 +02:00