Commit graph

5131 commits

Author SHA1 Message Date
Wim Taymans
9c34a923db pulse-server: simplify latency handling
We don't need to use the minreq field. The fragsize is only updated when
adjust_latency is used.
2022-09-01 16:46:18 +02:00
Wim Taymans
ad214dde2e pulse-server: tweak the fragsize/minreq handling
Only send 2/3 of the fragsize
2022-09-01 16:23:56 +02:00
Wim Taymans
e10305851d pulse-server: send chunks with half the fragsize
PulseAudio configures half of the fragsize as the source latency. It
also sends chunks as soon as they become available.

This means that we also need to configure the source with half of
the fragsize latency and send in chunks of fragsize/2. Keep this in
the unused (for record) minreq field.
2022-09-01 15:46:17 +02:00
Wim Taymans
f48f158566 filter-chain: fix includes 2022-09-01 14:08:38 +02:00
Wim Taymans
0126663238 context: remove unused function 2022-08-31 13:52:19 +02:00
Wim Taymans
c20790c64b pulse-tunnel: destroy the module on errors
When the pulse context or stream is in error, destroy the module.
2022-08-30 16:09:04 +02:00
Wim Taymans
9248ce3c19 pulse-tunnel: fix rate adjustement argument
The sign of the error was wrong, making the rate controller adjust in
the wrong direction and make things worse.

See #2548
2022-08-30 16:01:14 +02:00
Wim Taymans
5ae1c03d77 module-rt: small fixes
could_use_rtkit -> can_use_rtkit.
Only warn when setting nice and there is no rtkit fallback.
Always call set_rtlimit, it does not have an rtkit implementation, if just
has some properties with limits.
Only try to set nice again with rtkit when we required rtkit for some
functions.
2022-08-30 15:15:56 +02:00
Yuxuan Shui
2e9ba289d3 module-rt: retry with RtKit if set_nice or set_rlimit fails
Previously module-rt only checks if the user have the permission to use
realtime scheduling, and will unconditioally disable RtKit if they do,
even when they don't have the permission to set nice or rlimit.
2022-08-30 14:50:48 +02:00
Gleb Popov
c6ffeeeb34 On FreeBSD do not try to redefine O_PATH.
FreeBSD 13+ versions do have O_PATH flag, but FreeBSD 12, which is still supported
does not.
2022-08-21 22:43:31 +03:00
Gleb Popov
ad13681d33 Guard <sys/vfs.h> inclusion with an #ifdef. 2022-08-21 22:42:57 +03:00
Wim Taymans
f9e7fd7c67 avb: free resources on error 2022-08-20 21:41:59 +02:00
James Hilliard
1ea1d525c1 gst: copy buffer memory in dequeue_buffer using gst_memory_copy
When always-copy is enabled we should copy buffer memory instead of
sharing buffer memory and using gst_buffer_copy_deep.

This should ensure we recycle the parent buffer as soon as the memory
is copied.

Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
2022-08-20 09:30:44 -06:00
Thomas Weißschuh
a969feb3c0 avb: validate random data for xsubi 2022-08-19 07:35:02 +00:00
Thomas Weißschuh
f2e1827e18 utils: pw_getrandom: warn on unused return value
The return value tells us if we actually got any random data so it
should not be ignored.
2022-08-19 07:35:02 +00:00
Thomas Weißschuh
987069cc3c utils: pw_getrandom() use errno from read() call
The errno from read is more useful than the one from close() clobbering
it. So make sure to preserve the real reason for failure for the caller.
2022-08-19 07:35:02 +00:00
Thomas Weißschuh
bbb3cdc185 pw-cat: clean up resource correctly on EIO
The core has already been connected and the loop is running so we also
have to clean those up.

Fixes #2651
2022-08-19 07:34:02 +00:00
Wim Taymans
0532d194ad protocol-native: small cleanups
Style fixes.
Use new variable for fd to avoid casts.
Generate an error when  the fd is invalid.
2022-08-17 19:56:52 +02:00
Cameron Nemo
0883a0163b protocol-native: write socket address into fd
Support fork-free readiness notifications.

Without this, a service supervisor that does not implement socket
activation has no way of knowing whether or not pipewire is ready to
accept connections on the socket.

s6 is the most popular service manager that supports this mechanism.
See here: https://skarnet.org/software/s6/notifywhenup.html
2022-08-17 17:41:21 +00:00
Dmitry Sharshakov
3ceb3288ca convolver: fix crash on FFT unload
Co-authored-by: Barnabás Pőcze <pobrn@protonmail.com>
2022-08-17 11:22:05 +00:00
Barnabás Pőcze
68ff3ad841 treewide: meson.build: use host_machine instead of build_machine
At the moment, cross compilation may not work in certain cases because
checks are carried out against the build machine instead of the host machine.
Replace uses of `build_machine` with `host_machine` to fix that.

In native compilation, all three "machine objects" available in meson
are the same, so this change should have no effect in that case.

More: https://mesonbuild.com/Cross-compilation.html
2022-08-17 07:34:20 +00:00
Gleb Popov
4a0395d23e Enable AVB on Linux only. 2022-08-11 17:23:16 +03:00
Wim Taymans
27dcbfc1ee remote-node: don't set activation state and signal_time twice
This is already set by resume_node.
2022-08-11 12:35:51 +02:00
Wim Taymans
1bc1d96f88 node: rename signal to signal_func
To avoid confusion and it is more easily greppable
2022-08-11 12:34:51 +02:00
Wim Taymans
ca8b61e984 protocol-native: improve connection disconnect
The connection is created in new, therefore free it in destroy, not in
disconnect.
Connect sets the fd, so unset the fd in disconnect.
2022-08-11 12:07:59 +02:00
Wim Taymans
78c069ff87 potocol-native: improve error handling
Init the compat types map a little earlier so that it is initialized
when we try to clear it on error.
Add the client listener earlier so that we can use the events to clean
up the map, source and connection.
2022-08-11 12:06:28 +02:00
Wim Taymans
1e71c0e840 meson: also check for roc headers
Fixes #2513
2022-08-10 12:09:54 +02:00
Wim Taymans
f50aafed4d systemd: add filter-chain service
See #2553
2022-08-10 11:35:59 +02:00
Wim Taymans
50bdebe4e8 pw-cli: remove the dump command
It is mostly implemented as part of wpctl status, pw-dump, pw-link, pw-top and
others.
2022-08-10 10:36:56 +02:00
Wim Taymans
851bfba6ed pw-cli: add alias in comand help
Add alias to docs and mention alias in help.

Fixes #2552
2022-08-10 10:35:35 +02:00
Wim Taymans
fe5e164876 keys: improve docs a little
Fixes #2563
2022-08-10 10:13:32 +02:00
Wim Taymans
32cf5f312b data-loop: call pw_loop_invoke directly
The loop invoke method will already call the function directly when the
thread has been stopped and will also make sure that pending items are
flushed first.

See #2631
2022-08-09 20:16:33 +02:00
Barnabás Pőcze
9d5f565682 pipewire: extend memfd name with additional information
Knowing the flags, type, and size that were used in
the `pw_mempool_alloc()` call can be useful for
debugging purposes.
2022-08-09 11:24:00 +00:00
Wim Taymans
da86e6fbe1 impl-port: remove io when no port outputs
We set the node port io when we negotiate buffers on the port but never
unset it.
With this patch, the port io is cleared again when no mixers are on the
port. This can make the node a bit more efficient.
2022-08-08 18:08:09 +02:00
Wim Taymans
e784e82b9a conf: allow masking od conf.d/ files
Read the .conf.d/ override files in the same order as the .conf files.
If we already have a .conf override file with the same name, it was one
with a higher priority and we ignore it.

This makes it possible to place a 10-rates.conf file in ~/.config that
will override a 10-rates.conf file in /etc and /usr/share.

Fixes #2629
2022-08-08 16:05:46 +02:00
Wim Taymans
f8d26b96b4 conf: don't error on empty files
mmap of an empty file gives EINVAL. Avoid this and just don't update the
config.
2022-08-08 16:03:11 +02:00
Wim Taymans
04a3f51722 conf: free override 2022-08-06 16:47:18 +02:00
Julian Bouzas
b718dd5046 conf: support overriding context configuration in a different location
Allows placing override configuration files into a different directory. This is
Useful when pipewire clients such as wireplumber want their fully commented
configuration files under /etc/wireplumber, and fully uncommented configuration
files under /usr/share/wireplumber.

The point is solving the issue of users copying files from /usr/share/pipewire,
which contain various critical settings in addition to tweaking the config,
and then encountering problems at upgrade time when new critical settings are
added.
2022-08-05 13:19:15 -04:00
Julian Bouzas
a9cf72932a context: move loading of configuration into conf.c 2022-08-05 12:54:20 -04:00
Wim Taymans
a23d154952 audioconvert: always use DSP rate on DSP ports
Always use the DSP rate on DSP ports for format conversion, not the
previous used rate.

This avoids some resampler reconfiguration as it negotiates a non-passthrough
rate conversion and then switches to passthrough when the rate correction is
done to match the graph rate.

See #2614
2022-08-03 11:32:10 +02:00
Pauli Virtanen
6d4d77802a pulse-server: give Manager permission for Flatpak apps with devices=all
Some Flatpak apps want to manage sound fully (change default outputs,
move streams from other applications).  Real Pulseaudio always grants
full permissions, but pipewire-pulse doesn't, which breaks some
applications, e.g. Zoom.

Work around this by granting the manager permission if the application
also has devices=all access.

To do things properly, this probably should use the Portal media roles,
but this would need further work elsewhere.
2022-08-01 19:36:00 +00:00
Pauli Virtanen
0e12242a1b modules: set pipewire.access.portal.app_id in access & pulse-server
When detecting a access=flatpak application, set also
pipewire.access.portal.app_id, if determined
2022-08-01 19:36:00 +00:00
Pauli Virtanen
3730e54484 modules: support getting app_id in pw_check_flatpak
Support getting the Flatpak application ID from the .flatpak-info file,
similarly as what xdg-desktop-portal does.
2022-08-01 19:36:00 +00:00
Pauli Virtanen
5e5339ce6c modules: refactor check_flatpak to a common place
Move check_flatpak used by module-access and module-protocol-pulse
to a common flatpak-utils.h
2022-08-01 19:36:00 +00:00
James Hilliard
4c43d39a64 impl-link: only free format in do_negotiate if copied
Fixes:
==716== Invalid free() / delete / delete[] / realloc()
==716==    at 0x4846DED: free (vg_replace_malloc.c:872)
==716==    by 0x48ABF37: do_negotiate (impl-link.c:425)
==716==    by 0x48ACBEF: check_states (impl-link.c:701)
==716==    by 0x48DB34B: process_work_queue (work-queue.c:87)
==716==    by 0x4F8B2B3: source_event_func (loop.c:591)
==716==    by 0x4F8D03F: loop_iterate (loop.c:430)
==716==    by 0x48B1A4B: pw_main_loop_run (main-loop.c:148)
==716==    by 0x10962F: main (pipewire.c:131)
==716==  Address 0x1ffeffd520 is on thread 1's stack
==716==  4112 bytes below stack pointer
==716==

Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
2022-08-01 19:30:54 +00:00
Hubert Figuière
f1dfa9797b Issue #2570 - Use the xdg-portal-destkop of rtkit
- If the xdg-desktop-portal is there, use it instead of rtkit
- This allow setting the rt priorities within Flatpak
2022-08-01 19:19:24 +00:00
Barnabás Pőcze
51b5aafeaa pipewire: module-echo-cancel: remove line that does nothing 2022-07-23 08:58:18 +00:00
Pauli Virtanen
b3db13be10 stream: don't do overlapping assignment of union members
Coverity does not like assigning union member to another. Don't use
union here, as it's not needed.
2022-07-21 07:12:22 +00:00
Wim Taymans
f857fd4626 avb: fix compilation on big endian 2022-07-19 15:59:00 +02:00
Wim Taymans
1a5ec4452f avb: fix compilation on big endian 2022-07-19 13:49:42 +02:00