PipeWire update in master

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello everyone,

I have pushed a PipeWire / WirePlumber update in gerrit [1] to be included in master for the next AGL release (LL). In this email I want to give an overview of what has changed, so that you have a starting point to work with it until the documentation is fully up-to-date (WIP).

PipeWire
---

PipeWire has been updated to version 0.3.25+. I plan to update it again to a release version (perhaps .26 or .27) before the final freeze for LL.

Support for embedded devices has been improved in this release. Devices like the ones found in the iMX family of SoCs should now work well without additional patches. For some devices, though, there may be a need for tweaking things. Many configuration options exist and are documented in
  https://gitlab.freedesktop.org/pipewire/pipewire/-/wikis/Config-ALSA

However, bear in mind that this wiki page applies to pipewire's default session manager and NOT to wireplumber. The equivalent file for tweaking these options in wireplumber is
  /etc/wireplumber/config.lua.d/30-alsa-monitor.lua

I will provide further documentation on this topic as soon as possible.

WirePlumber
---

WirePlumber has been updated to the git master version (0.3.70+, to be released as 0.4.0)

Among other things, this version introduces Lua-based configuration and scripting.

The default configuration file is now /etc/wireplumber/config.lua,
which can be split into several files in /etc/wireplumber/config.lua.d/
All files are interpreted in the same context (so variables from one file are accessible in the next ones) and so it is possible to override
options in other files without touching the default ones.

The purpose of this configuration file is to load modules and scripts in wireplumber and activate them. It cannot do anything else, as it does not have access to the full lua API that wireplumber implements.

Apart from configuration, there are also scripts. Scripts have access to the full API and implement the logic of wireplumber (policy, device loading, etc...). The upstream scripts are installed in /usr/share/wireplumber/scripts and it is possible to override them by installing equivalents in /etc/wireplumber/scripts/. Scripts in /etc will shadow the scripts in /usr that have the same name, so if you wish to experiment changing a script, it is advised that you copy it first to /etc and modify it there.

Additionally, it is possible to execute scripts standalone on the command line in order to test them or to implement tools to do things with pipewire. These scripts are executed with /usr/bin/wpexec. You can see examples of such standalone scripts in
https://gitlab.freedesktop.org/pipewire/wireplumber/-/tree/master/tests/examples

Tools
---

PipeWire tools are now named differently and they all have the 'pw-' prefix in their names. All of these tools are now packaged in a separate package and are only available in the image if you build with the 'agl-devel' feature.

pw-cli is the main tool for interacting with pipewire.

There is also pw-dump, which dumps all objects in a big JSON. The output of this tool is very useful to include in bug reports. It is also suitable for implementing scripts that parse information with jq.

pw-dot is another useful debug tool that dumps the objects in a dot graph for easy visualization

pw-cat / pw-play / pw-record: This is a set of tools similar to aplay/arecord, for simple audio operations

pw-top: This is a performance measurement tool that shows realtime timing information about the audio pipeline. Before running this tool, you will need to uncomment the loading of "libpipewire-module-profiler" in /etc/pipewire/pipewire.conf and restart pipewire.

Wireplumber also has a tool called wpctl. This is available always (not only on 'agl-devel') and replaces the old wireplumber-cli. It allows inspecting the devices, choosing which source & sink are the default ones and provides the equivalent of the mixer on the command line.
Try "wpctl status" and "wpctl help" to get started with it.

Mixer
---

The mixer app has been updated to work with the latest underlying APIs. It also now exposes a "Master Capture" volume, that controls the microphone volume, and it also exposes again all the role-specific volumes.

Bluetooth
---

Bluetooth audio using bluez and ofono is now provided by PipeWire natively instead of relying on bluez-alsa hacks. Audio from a mobile phone is also now properly routed through the "Communication" role endpoint and adheres to the policy.

bluez-alsa should no longer be present in the images.

Policy
---

WirePlumber policy is now fully scripted in lua and can be more easily adapted to suit your needs.

For AGL, wireplumber exposes a set of "Endpoints" that correspond to media roles, like before. When playing audio, clients are routed through those endpoints and adhere to rules, based on the configured priority of the roles. The configuration for this is in
  /etc/wireplumber/config.lua.d/10-default-policy.lua

In order for clients to be considered for this policy, they must have the "media.role" property set on them. In gstreamer this is done by adding "stream-properties=p,media.role=<role>" to the properties of pipewiresink. In pw-play, there is the --media-role command line option.

If the media.role is not set, the client is considered for linking with the standard desktop policy, which is also enabled. This will link the client directly to the device and it will not be subject to the rules. I plan to make this configurable in another update, so that such usage can be prohibited.

Unlike before, with this update it is possible to have different actions per role. For instance, for the Multimedia role, it is not allowed to have more than one client playing at a time, so only the last one is linked and the others are corked. For other roles, it is allowed to mix sounds of the same role while sounds of lower priority roles are corked. In another update I am also planning to add the option to "duck" the volume of another role instead of corking it.

Security
---

Both PipeWire and WirePlumber are now executed as a separate 'pipewire' user. The socket for pipewire is placed in /run/pipewire/ and is accessible by all other users.

For use with AGL's current app framework, there is a pipewire module that allows by default full access to clients that have the "System" SMACK label and restricts all other clients.

Then, there is a wireplumber access policy script that grants full access again to clients that have a SMACK label starting with "User::App::". This will be changed in another update. The plan is to keep such clients still restricted, based on what their role is, and only allow them to use specific pipewire objects.

Known Issues
---

At the time of writing, I am aware of 3 issues so far.

1. An unresolved issue from the past: When corking clients, these clients are not fully aware about the fact that they have been corked. Also, when the clients are paused, the session manager is not fully aware about the fact that they are paused. This can lead to bad behavior if clients are paused instead of stopped. This is discussed in [2]

2. When pausing a gstreamer pipewiresink for too long and then resuming it again, it may end up in a situation where it doesn't play. This is reported in [3].

3. On the H3 reference hardware board, a microphone connected on the 'mic' port does not sound right. The audio is garbled. This seems to be some strange driver configuration / latency issue. It works under certain conditions with plain alsa (tried with gstreamer alsasrc), but not with pipewire. I will investigate this further.

Best regards,
George


[1]. https://gerrit.automotivelinux.org/gerrit/c/AGL/meta-agl/+/26094
[2]. https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/205
[3]. https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/1048


-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#9138): https://lists.automotivelinux.org/g/agl-dev-community/message/9138
Mute This Topic: https://lists.automotivelinux.org/mt/82230079/2167316
Group Owner: agl-dev-community+owner@xxxxxxxxxxxxxxxxxxxxxxxxx
Unsubscribe: https://lists.automotivelinux.org/g/agl-dev-community/leave/4543822/2167316/883735764/xyzzy [list-automotive-discussions82@xxxxxxxxxxx]
-=-=-=-=-=-=-=-=-=-=-=-





[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux