New financed postmarketOS project: wireplumber and callaudiod

August 17, 20254 min. read

A OnePlus 6 and Pixel 3a running postmarketOS showing GNOME Usage and one of
the MRs in this blog post. They are on top of two postmarketOS T-shirts, one
with the logo on white, and one which describes some of the goals of the
project

Since May, we had already received more money in donations than we had budgeted for the whole year. As stated in our latest budget, our goal for this year is not to save the money, but to put it to use. Therefore, the postmarketOS team decided to amend the budget to add a project expense of 6400€ for audio-related work. We decided on the topic and amount for the following reasons:

The project: replacing callaudiod with wireplumber plugin

callaudiod was started by Arnaud, the Mobian founder and one of its main contributors, as a way to automate routing changes for phones calls. This basically means that as you are listening to music on your device, and you receive a phone call, the phone automatically changes audio sources so that the speakers play the audio coming from the modem, instead of from your music player. It was designed to work within the PulseAudio stack, since it was the most mature solution at the time.

However, Pipewire and Wireplumber have improved considerably since then and they are universally agreed as the future (and sometimes present) of audio on Linux. Unfortunately, the callaudiod solution is lacking in many ways when interacting with this stack. Therefore, more than a year and half ago, Arnaud opened an issue to discuss a way forward that would integrate audio routing in Pipewire+Wireplumber. Such solution would not require callaudiod, resolving all kind of issues. On the following months, the issue saw some discussion, the final design on how it should be done was finalised, but nobody managed to put in the work to implement it.

From the problem to a solution

Pablo had already been looking for people to possibly work on the audio stack for a while. Compared to other problems that the Linux Mobile community faces where things regularly improve and move forward, audio is specially challenging. There seem to be very few people with the knowledge and skills to work on it, not to mention the time. Luckily, in a discussion with community members, Pablo found that Richard A. did have the interest to work in this field, and enough proven record to able to tackle complex issues:

In addition, Richard A. was available for contracting work through the summer. After talking with Arnaud, he helped setting the project goals and requirements, while being available to answer technical and design questions!

Scope and requirements

After discussing with the team, Richard A., and Arnaud, the project was set to fulfill the following goals:

  1. Create a WirePlumber module upstream that could talk to ModemManager and detect when calls are active.
  2. Create a set of default lua scripts in WirePlumber that acting on the output of the module could switch profiles. The goal is that during calls, the profile would be automatically set for that of VoiceCalls, and then turned back to how it was before.

As a consequence, this should be able to take care of audio routing seamlessly without the need of an extra component (callaudiod). This would also make it unnecessary for applications like GNOME Calls or Plasma Dialer to take any action regarding audio. Simply starting a call through ModemManager will trigger WirePlumber to do the right thing.

In addition to routing, callaudiod also takes care of muting the microphone and switching audio to the speaker when requested by applications. Unfortunately, although they might look trivial, implementing those actions correctly requires a considerable design effort. As Arnaud put it: "thinking about those is mostly pointless until we have a stable, future-proof solution for profile switching". So replacing those callaudiod features are considered a follow-up, and not part of this project.

Results and work ahead

The project has been going on for the most part of the summer, and has moved on at the expected pace. Richard A. has sent merge request upstream to implement the plugin and the lua scripts. Part of it has also already been paid out by your donations from Open Collective.

Right now, that work is pending some upstream reviews to get integrated. Once that is ready, and before wireplumber gets updated, callaudiod will have to detect whether wireplumber is in use, to avoid race conditions. Once all that is in place, we can start soft-deprecating parts of the callaudiod API, and start thinking about how to implement switching to speakers and muting the microphones!

All-in-all, there is still quite a path ahead to stop depending on callaudiod for postmarketOS and other Linux-on-Mobile projects. Still, we are happy to be helping financially and with project management to move the ecosystem forward. We look forward to see the stack continue maturing around ourselves.

If you would like to see postmarketOS continue paying for development work, and appreciate the work we are doing, consider donating via our OpenCollective!

This blog post was written by Pablo. Header image by Markus, Pablo.