Previously, the resource listener was not removed when
the `node_data` object was freed, which could lead to
a use-after-free when the resource emitted an event
later.
==2787072==ERROR: AddressSanitizer: heap-use-after-free on address 0x61d000016728 at pc 0x7ffff7175b52 bp 0x7fffffffb930 sp 0x7fffffffb920
WRITE of size 8 at 0x61d000016728 thread T0
#0 0x7ffff7175b51 in spa_list_remove ../spa/include/spa/utils/list.h:77
#1 0x7ffff717cb5a in pw_resource_destroy ../src/pipewire/resource.c:335
#2 0x7ffff7051c56 in pw_global_destroy ../src/pipewire/global.c:417
#3 0x7ffff6f82a68 in registry_destroy ../src/pipewire/impl-core.c:130
#4 0x7ffff3a5f349 in registry_demarshal_destroy ../src/modules/module-protocol-native/protocol-native.c:784
#5 0x7ffff3a2c9ed in process_messages ../src/modules/module-protocol-native.c:352
#6 0x7ffff3a2e2ea in connection_data ../src/modules/module-protocol-native.c:423
#7 0x7ffff3e09402 in source_io_func ../spa/plugins/support/loop.c:427
#8 0x7ffff3e0851d in loop_iterate ../spa/plugins/support/loop.c:409
#9 0x7ffff709c21d in pw_main_loop_run ../src/pipewire/main-loop.c:148
#10 0x555555559722 in main ../src/daemon/pipewire.c:131
#11 0x7ffff62a528f (/usr/lib/libc.so.6+0x2928f)
#12 0x7ffff62a5349 in __libc_start_main (/usr/lib/libc.so.6+0x29349)
#13 0x5555555582a4 in _start (./src/daemon/pipewire+0x42a4)
0x61d000016728 is located 2216 bytes inside of 2264-byte region [0x61d000015e80,0x61d000016758)
freed by thread T0 here:
#0 0x7ffff798c672 in __interceptor_free /usr/src/debug/gcc/libsanitizer/asan/asan_malloc_linux.cpp:52
#1 0x7ffff70f9bc3 in pw_impl_node_destroy ../src/pipewire/impl-node.c:1880
#2 0x7ffff70d1d57 in global_destroy ../src/pipewire/impl-node.c:638
#3 0x7ffff7051a4f in pw_global_destroy ../src/pipewire/global.c:414
#4 0x7ffff6f82a68 in registry_destroy ../src/pipewire/impl-core.c:130
#5 0x7ffff3a5f349 in registry_demarshal_destroy ../src/modules/module-protocol-native/protocol-native.c:784
#6 0x7ffff3a2c9ed in process_messages ../src/modules/module-protocol-native.c:352
#7 0x7ffff3a2e2ea in connection_data ../src/modules/module-protocol-native.c:423
#8 0x7ffff3e09402 in source_io_func ../spa/plugins/support/loop.c:427
#9 0x7ffff3e0851d in loop_iterate ../spa/plugins/support/loop.c:409
#10 0x7ffff709c21d in pw_main_loop_run ../src/pipewire/main-loop.c:148
#11 0x555555559722 in main ../src/daemon/pipewire.c:131
#12 0x7ffff62a528f (/usr/lib/libc.so.6+0x2928f)
previously allocated by thread T0 here:
#0 0x7ffff798d411 in __interceptor_calloc /usr/src/debug/gcc/libsanitizer/asan/asan_malloc_linux.cpp:77
#1 0x7ffff70e5bb7 in pw_context_create_node ../src/pipewire/impl-node.c:1192
#2 0x7ffff28c748e in pw_spa_node_new ../src/modules/spa/spa-node.c:112
#3 0x7ffff28c9a9f in pw_spa_node_load ../src/modules/spa/spa-node.c:276
#4 0x7ffff28c1618 in create_object ../src/modules/spa/module-node-factory.c:134
#5 0x7ffff7106c4e in pw_impl_factory_create_object ../src/pipewire/impl-factory.c:273
#6 0x7ffff6f86dd7 in core_create_object ../src/pipewire/impl-core.c:349
#7 0x7ffff3a5cba9 in core_method_demarshal_create_object ../src/modules/module-protocol-native/protocol-native.c:680
#8 0x7ffff3a2c9ed in process_messages ../src/modules/module-protocol-native.c:352
#9 0x7ffff3a2e2ea in connection_data ../src/modules/module-protocol-native.c:423
#10 0x7ffff3e09402 in source_io_func ../spa/plugins/support/loop.c:427
#11 0x7ffff3e0851d in loop_iterate ../spa/plugins/support/loop.c:409
#12 0x7ffff709c21d in pw_main_loop_run ../src/pipewire/main-loop.c:148
#13 0x555555559722 in main ../src/daemon/pipewire.c:131
#14 0x7ffff62a528f (/usr/lib/libc.so.6+0x2928f)
SUMMARY: AddressSanitizer: heap-use-after-free ../spa/include/spa/utils/list.h:77 in spa_list_remove
|
||
|---|---|---|
| .gitlab/issue_templates | ||
| doc | ||
| include/valgrind | ||
| man | ||
| pipewire-alsa | ||
| pipewire-jack | ||
| pipewire-v4l2 | ||
| po | ||
| spa | ||
| src | ||
| subprojects | ||
| test | ||
| .cirrus.yml | ||
| .codespell-ignore | ||
| .editorconfig | ||
| .gitignore | ||
| .gitlab-ci.yml | ||
| autogen.sh | ||
| check_missing_headers.sh | ||
| CODE_OF_CONDUCT.md | ||
| COPYING | ||
| INSTALL.md | ||
| LICENSE | ||
| Makefile.in | ||
| meson.build | ||
| meson_options.txt | ||
| NEWS | ||
| pw-uninstalled.sh | ||
| README.md | ||
| template.test.in | ||
PipeWire
PipeWire is a server and user space API to deal with multimedia pipelines. This includes:
- Making available sources of video (such as from a capture devices or application provided streams) and multiplexing this with clients.
- Accessing sources of video for consumption.
- Generating graphs for audio and video processing.
Nodes in the graph can be implemented as separate processes, communicating with sockets and exchanging multimedia content using fd passing.
Building and installation
The preferred way to install PipeWire is to install it with your distribution package system. This ensures PipeWire is integrated into the rest of your system for the best experience.
If you want to build and install PipeWire yourself, refer to install for instructions.
Usage
The most important purpose of PipeWire is to run your favorite apps.
Some applications use the native PipeWire API, such as most compositors (gnome-shell, wayland, ...) to implement screen sharing. These apps will just work automatically.
Most audio applications can use either ALSA, JACK or PulseAudio as a backend. PipeWire provides support for all 3 backends. Depending on how your distribution has configured things this should just work automatically or with the provided scripts shown below.
PipeWire can use environment variables to control the behaviour of applications:
PIPEWIRE_DEBUG=<level>to increase the debug level (or use one ofXEWIDTfor none, error, warnings, info, debug, or trace, respectively).PIPEWIRE_LOG=<filename>to redirect log to filenamePIPEWIRE_LOG_SYSTEMD=falseto disable logging to systemd journalPIPEWIRE_LATENCY=<num/denom>to configure latency as a fraction. 10/1000 configures a 10ms latency. Usually this is expressed as a fraction of the samplerate, like 256/48000, which uses 256 samples at a samplerate of 48KHz for a latency of 5.33ms. This function does not attempt to configure the samplerate.PIPEWIRE_RATE=<num/denom>to configure a rate for the graph.PIPEWIRE_QUANTUM=<num/denom>to configure latency as a fraction and a samplerate. This function will attempt to change the graph samplerate todenomand use the specifiednumas the buffer size.PIPEWIRE_NODE=<id>to request a link to the specified node
Using tools
pw-cat can be used to play and record audio and midi. Use pw-cat -h to get
some more help. There are some aliases like pw-play and pw-record to make
things easier:
$ pw-play /home/wim/data/01.\ Firepower.wav
Running JACK applications
Depending on how the system was configured, you can either run PipeWire and JACK side-by-side or have PipeWire take over the functionality of JACK completely.
In dual mode, JACK apps will by default use the JACK server. To direct a JACK
app to PipeWire, you can use the pw-jack script like this:
$ pw-jack <appname>
If you replaced JACK with PipeWire completely, pw-jack does not have any
effect and can be omitted.
JACK applications will automatically use the buffer-size chosen by the
server. You can force a maximum buffer size (latency) by setting the
PIPEWIRE_LATENCY environment variable like so:
PIPEWIRE_LATENCY=128/48000 jack_simple_client
Requests the jack_simple_client to run with a buffer of 128 or
less samples.
Running PulseAudio applications
PipeWire can run a PulseAudio compatible replacement server. You can't use both servers at the same time. Usually your package manager will make the server conflict so that you can only install one or the other.
PulseAudio applications still use the regular PulseAudio client libraries and you don't need to do anything else than change the server implementation.
A successful swap of the server can be verified by checking the output of
pactl info
It should include the string:
...
Server Name: PulseAudio (on PipeWire 0.3.x)
...
You can use pavucontrol to change profiles and ports, change volumes or redirect streams, just like with PulseAudio.
Running ALSA applications
If the PipeWire alsa module is installed, it can be seen with
$ aplay -L
ALSA applications can then use the pipewire: device to use PipeWire
as the audio system.
Running GStreamer applications
PipeWire includes 2 GStreamer elements called pipewiresrc and
pipewiresink. They can be used in pipelines such as this:
$ gst-launch-1.0 pipewiresrc ! videoconvert ! autovideosink
Or to play a beeping sound:
$ gst-launch-1.0 audiotestsrc ! pipewiresink
PipeWire provides a device monitor as well so that
$ gst-device-monitor-1.0
shows the PipeWire devices and applications like cheese will automatically use the PipeWire video source when possible.
Inspecting the PipeWire state
To inspect and manipulate the PipeWire graph via GUI, you can use Helvum.
Alternatively, you can use use one of the excellent JACK tools, such as Carla,
catia, qjackctl, ...
However, you will not be able to see all features like the video
ports.
pw-mon dumps and monitors the state of the PipeWire daemon.
pw-dot can dump a graph of the pipeline, check out the help for
how to do this.
pw-top monitors the real-time status of the graph. This is handy to
find out what clients are running and how much DSP resources they
use.
pw-dump dumps the state of the PipeWire daemon in JSON format. This
can be used to find out the properties and parameters of the objects
in the PipeWire daemon.
There is a more complicated tool to inspect the state of the server
with pw-cli. This tool can be used interactively or it can execute
single commands like this to get the server information:
$ pw-cli info 0
Documentation
Find tutorials and design documentation here.
The (incomplete) autogenerated API docs are here.
The Wiki can be found here
Contributing
PipeWire is Free Software and is developed in the open. It is mostly licensed under the MIT license. Check LICENSE for more details about the exceptions.
Contributors are encouraged to submit merge requests or file bugs on gitlab.
Join us on IRC at #pipewire on OFTC.
We adhere to the Contributor Covenant for our code of conduct.