I don't think this is really a tutorial so much as just finding out about some things.
I didn't realize this until today when I was logged in as two different user accounts on the same computer.
When using an application that uses pipewire (almost all audio applications) the current user owns the process. However, each logged in user has its instance of pipewire.
This can also be seen with lsof
On my distro (I haven't checked any other distros at this time) the configuration file /usr/share/pipewire/pipewire.conf is owned by root.
A handy command to check the current configuration is...
Looking at the source code...Pipewire consists of around 30k lines of code in the C programming language.
How to see what pipewire modules you have...
How to see what plugins you have installed...
I discovered a command called "pw-top". It's like top, but just for pipewire processes.
Another handy command is..
Now I haven't tried all of these out yet, but it's interesting just to see what you do with pipewire.
Finally there a graph command as well. (You may need to install loupe)
I am finding out more and more about this as I go. This would be a good candidate for a part 2.
I didn't realize this until today when I was logged in as two different user accounts on the same computer.
When using an application that uses pipewire (almost all audio applications) the current user owns the process. However, each logged in user has its instance of pipewire.
Code:
ray@abdTower1:~$ ps -eo pid,uid,gid,user,comm,label | grep pipewire
2216 1000 1000 rg pipewire unconfined_t
This can also be seen with lsof
Code:
ray@abdTower1:~$ lsof | grep -E '/dev/snd|/dev/video*|/dev/media*'
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
pipewire 53799 rg 44u CHR 116,9 0t0 913 /dev/snd/controlC0
pipewire 53799 rg 83u CHR 81,0 0t0 884 /dev/video0
wireplumb 53801 rg 24u CHR 116,9 0t0 913 /dev/snd/controlC0
On my distro (I haven't checked any other distros at this time) the configuration file /usr/share/pipewire/pipewire.conf is owned by root.
A handy command to check the current configuration is...
Code:
ray@absTower1:~$ pw-config
{
"config.path": "/usr/share/pipewire/pipewire.conf",
"override.config.path": "~/.config/pipewire/pipewire.conf.d/loops.conf"
}
Looking at the source code...Pipewire consists of around 30k lines of code in the C programming language.
How to see what pipewire modules you have...
Code:
ray@absTower1:~$ ls -la /usr/lib64/pipewire-0.3/
-rwxr-xr-x. 1 root root 28296 Nov 26 01:00 libpipewire-module-access.so
-rwxr-xr-x. 1 root root 98808 Nov 26 01:00 libpipewire-module-avb.so
How to see what plugins you have installed...
Code:
ray@absTower1:~$ ls -la /usr/lib64/spa-0.2/
drwxr-xr-x. 1 root root 28 Dec 11 12:13 alsa
drwxr-xr-x. 1 root root 420 Dec 11 12:13 bluez5
...
I discovered a command called "pw-top". It's like top, but just for pipewire processes.
Code:
ray@absTower1:~$ pw-top
S ID QUANT RATE WAIT BUSY FORMAT NAME
R 90 512 48000 139.8us 23.0us S16LE 2 48000 bluez_output..
R 99 900 48000 66.7us 37.7us F32LE 2 48000 + Firefox
R 112 4320 48000 105.5us 11.4us S16LE 2 48000 + Videos
Quantum (QUANT) can be thought of as the number of audio samples (buffer size) to be processed each graph cycle. This varies depending on the device type and can be configured or negotiated via configuration files. For example, the Videos application has a buffer size of 4320 samples, while the Bluetooth output node has only 512.
Rate (RATE) is the graph processing frequency. In the above output, the graph operates at 48 kHz, meaning each second the graph can process 48,000 samples.
The ratio between Quantum and Rate is the latency in seconds. In the case of Bluetooth headsets, the latency is 11 ms, while for the Videos app it is 90 ms. The pw-top man page provides links to better explanations. Understanding these indicators can help boost performance.
Another handy command is..
Code:
ray@absTower1:~$ pw-cli h
Available commands:
help | h Show this help
load-module | lm Load a module.
unload-module | um Unload a module.
connect | con Connect to a remote.
disconnect | dis Disconnect from a remote.
list-remotes | lr List connected remotes.
switch-remote | sr Switch between current remotes.
list-objects | ls List objects or current remote.
info | i Get info about an object.
create-device | cd Create a device from a factory.
create-node | cn Create a node from a factory.
destroy | d Destroy a global object.
create-link | cl Create a link between nodes.
export-node | en Export a local node
enum-params | e Enumerate params of an object
set-param | s Set param of an object
permissions | sp Set permissions for a client
get-permissions | gp Get permissions of a client
send-command | c Send a command <object-id>
quit | q Quit
Now I haven't tried all of these out yet, but it's interesting just to see what you do with pipewire.
Finally there a graph command as well. (You may need to install loupe)
Code:
ray@absTower1:~$ pw-dot --detail --all
ray@absTower1:~$ dot -Tpng pw.dot -o pw.png
ray@absTower1:~$ loupe pw.png
Pipewire comes with a module called protocol-pulse. The module has a separate systemd socket-activated user service. This emulates a PulseAudio server for compatibility with a large range of clients still using the PulseAudio libraries.
Code:
ray@absTower1:~$ ls -laZ /run/user/1000/pulse/native
srw-rw-rw-. rg rg user_tmp_t:s0 /run/user/1000/pulse/native
I am finding out more and more about this as I go. This would be a good candidate for a part 2.