September 2019

PulseAudio 13.0 is out now! Read the release notes to find out what’s new.

Last month I did some work on pavucontrol. I finished the patch that changes the stream device selection button to a drop-down list (that’s still pending review). I also fixed the logic of when pavucontrol shows advanced options for sinks and sources. It used to hide the compressed format configuration for all sinks that don’t have any ports. That didn’t cause problems before, because it used to be so that all sinks that support compressed formats happened to also have ports, but now the null sink also supports compressed format configuration, and the null sink doesn’t have ports. While working on that, I also noticed that the sink and source widgets didn’t handle updates from the server correctly. Every update caused pavucontrol to send a “set port” command to the server using the currently selected port, which often isn’t that harmful, but it could cause trouble in some cases, because PulseAudio needs to know when a port has been selected by the user and when it has been selected as part of some automatic policy. That’s now fixed.

module-null-sink can be configured at load time to support compressed formats, but it didn’t support changing the supported format list at runtime. All the “hard” parts of that were actually already implemented, the only thing missing was a flag that marks the sink as one that supports runtime format configuration. I added that flag, and together with the pavucontrol fixes it’s now possible to use pavucontrol (or pactl) to configure the null sink formats at runtime. That’s not particularly exciting for regular users, though; the compressed format support in the null sink is useful mainly for debugging and testing.

The Modules wiki page was missing documentation for module-null-sink’s “formats” argument, I fixed that shortcoming.

Flat volumes have always been a controversial feature in PulseAudio. If you’re not familiar with the feature, here’s a short summary: with flat volumes the stream volumes control also the sink volume. In the simple case of only one stream, the stream and the sink volume are always the same. In case of multiple streams, the sink volume is set to the maximum of the stream volumes. The purpose of this is to simplify the volume control of an application: the full volume range is always available via the application volume slider, so there’s no need to think about the sink volume. In practice, however, this has caused more harm than good (the worst problem is that some application automatically set their stream volume to 100%, causing the audio to be played at the maximum volume that the hardware can produce), and most large distributions have patched PulseAudio to disable flat volumes by default. I’ve been meaning for a long time to submit a patch to disable the feature by default also in upstream, and now that’s finally done.

Here’s a list of patches I reviewed last month:

  • Samuel Thibault submitted a patch by Svante Signell to make the webrtc-audio-processing library build on GNU/Hurd and GNU/kFreeBSD.
  • Jan Alexander Steffens fixed the module-tunnel-sink build when using Meson, and he also fixed the way how X11 compiler flags are passed to module-tunnel-source.
  • Rasmus Thomsen fixed the Meson build system to work with musl, which requires linking to an external libintl library.
  • Arun Raghavan updated an older merge request that implements automatic channel reconfiguration for passthrough streams. It’s needed for high bitrate passthrough streams (Dolby TrueHD and DTS-HD Master Audio). Support for those high bitrate passthrough streams were advertised in the 13.0 release notes, but it turned out that it didn’t actually work yet, because we forgot that these patches were needed for it to work. I reviewed the first three patches (and requested several changes), I will continue with the rest soon.
  • Peter Levine made a fix for a build failure with Clang 9.0.0. The new Clang version apparently doesn’t like implicit casts from void pointers to unsigned longs.

This post was originally written on 2019-10-10, and first made available to my Patreon supporters. Speaking of Patreon – I’m using crowdfunding in an attempt to make it financially sustainable to continue my volunteer work as a PulseAudio maintainer. If you’d like to help, check out my Patreon page (or Liberapay).

August 2019

There’s not much to report from August, other things distracted me from PulseAudio work. I just replied some issues and emails, and did the following:

  • I improved bootstrap.sh so that when installing from PulseAudio from source, the build system won’t overwrite files in /etc by default (configuration files now get installed under /usr/local/etc instead).
  • I reviewed a patch from Carlos Garnacho to not load settings from the X11 root window except when using SSH with X11 forwarding. This avoids unnecessary use of X11 under Wayland.
  • I started improving pavucontrol’s stream routing UI. Currently selecting the device of a stream is implemented as a button that opens a list of devices as radio buttons in a popup. There was a report that the popup opens in a completely wrong place (different screen) in some environments (the reason seems to have something to do with the popup being implemented using a deprecated API). A button plus popup doesn’t make much sense anyway, a drop-down list is the usual way to implement this kind of selection. Replacing a button with a drop-down list sounds like a simple change, and in some ways it is, but I’m not that experienced with the Gtk API, so this is still a work in progress.

This post was originally written on 2019-09-05, and first made available to my Patreon supporters. Speaking of Patreon – I’m using crowdfunding in an attempt to make it financially sustainable to continue my volunteer work as a PulseAudio maintainer. If you’d like to help, check out my Patreon page (or Liberapay).

July 2019

Things that happened last month:

I reviewed a bunch of things:

  • a couple of bluetooth crash fixes from Frédéric Danis
  • localization related fixes in the Meson build system from Arun Raghavan
  • A2DP fixes from Pali Rohár
  • pasuspender help text improvement from S Page
  • fix in volume related assembly code for a bug that became visible with GCC 9.1 from Arun Raghavan
  • information collection script for debugging purposes from Russell Treleaven

I fixed a bug in pavucontrol that made application icons huge in some cases.

Every once in a while someone pops up in the PulseAudio IRC channel complaining that they can’t move audio of one particular application to a different device, and they don’t have any idea why (pavucontrol doesn’t provide any diagnostics help when moving a stream fails). Usually the application turns out to be a game that uses the OpenAL Soft library. The library disallows stream moves by default, but moves can be enabled in the ~/.config/alsoft.conf configuration file. I finally got around to submitting a bug report to OpenAL Soft, only to find out that the default configuration had been already changed (yay!). The change is pretty recent, and I don’t think it’s included in any OpenAL Soft release yet. I also learned why the library does that. PulseAudio is partly to blame, because module-device-manager moves streams in a way that used to mess up the device selection logic in OpenAL Soft, and disallowing moves was a workaround for that.

I worked on release notes a little bit. We’re pretty close to releasing PulseAudio 13.0 now, and the release notes are pretty much the only major thing remaining to do, if new problems don’t come up. There’s a fair bit of work to do with the release notes – figuring out the important changes requires reviewing a year’s worth of commits.

This post was originally written on 2019-08-09, and first made available to my Patreon supporters. Speaking of Patreon – I’m using crowdfunding in an attempt to make it financially sustainable to continue my volunteer work as a PulseAudio maintainer. If you’d like to help, check out my Patreon page (or Liberapay).

Is Liberapay legal in Finland?

Donating through Liberapay is definitely legal in Finland, but what about asking for donations?

Asking for donations in Finland generally requires a money collection permit (“rahankeräyslupa”), and such permission is only available to associations, foundations and things like that, not to individuals. I have a Liberapay profile for funding my volunteer software development work, and so far I’ve assumed that having that profile is obviously breaking the law. However, Mikaela Suomalainen pointed out that the Gambling Administration (“Arpajaishallinto”) that runs the money collection permit system interprets the law so that a Finnish person who uses an international crowdfunding platform doesn’t need a fundraising permit if the fundraising is not targeted at Finnish residents.

In the light of this new information, the top of my Liberapay page now has a note that asks Finnish residents to not donate. I believe that to be enough to ensure that even if the Gambling Administration finds out about my Liberapay page (unlikely), they won’t sue me. If that leads to losing some potential Finnish donors, that’s not so bad, since at the time of writing, only 2% of my Patreon income is from Finland (this statistic is based on me guessing the supporters’ country of residence based on their names). I don’t know the demographics of my Liberapay supporters, because the donations are anonymous.

Here’s the relevant text from the Gambling Administration web page:

I intend to use an international crowdfunding site on the internet. Do I still need a permit?

You need a money collection permit if the money collection campaign is run in Finland. This is the case when donations are meant to be received from people in Finland. Therefore, using a foreign website or making an appeal for donations in other languages than Finnish or Swedish does not mean that the campaign could be undertaken without a permit. If however, the appeals for donations are clearly targeted outside Finland, it is not a money collection campaign in Finland, and a permit is not necessary.

June 2019

Last month we finally decided to start the PulseAudio 13.0 release process. According to the usual release schedule that should have been done already last autumn… Oh well, better late than never. The master branch is now frozen, so only bug fixes will be merged from now until the final release. Arun has released the first release candidate, but it’s already known that another release candidate will be needed, because there are some A2DP fixes that we want to incorporate in the final release.

One of the release blockers was the problem I mentioned last month: GDM’s PulseAudio instance sometimes changed the hardware volume soon after logging in, overriding the logged in user’s volume preference. I finished the fix for that.

Georg Chini has been working on fixing glitches related to rewinds (including a fix for a serious and long-standing bug in monitor source rewinding, yay!). I reviewed some of those patches (not merged yet) and I also spent time discussing Georg’s proposal for adding a new buffer for handling resampler rewinds. That hasn’t so far been very fruitful, because I find Georg’s approach unintuitive and hence difficult to verify and maintain (it doesn’t help that rewinding is complex to begin with), while Georg thinks it’s pretty simple, and he doesn’t like my alternative proposal that he says makes the code more complicated.

Other patches that I reviewed:

  • Thomas Hutschenreuther found and fixed an issue in atomic operations on armv7 and higher. The old implementation caused random crashes in client applications, which must have been very difficult to debug.
  • Frédéric Danis fixed a bug in the bluetooth code related to phone calls via oFono. If a phone call was hung up immediately after creating it, PulseAudio sometimes crashed.
  • Hui Wang fixed module-stream-restore so that it doesn’t route streams to sinks whose active port is unavailable.
  • Topi Miettinen hardened the PulseAudio user service file for systemd so that PulseAudio can’t get new privileges and can’t make weird system calls.
  • Sangchul Lee fixed the avoid-resampling option handling for monitor sources. Previously the option wasn’t properly inherited from the monitored sink.
  • Pseudonym “shdown” fixed the handling of the timeout parameter of the pa_mainloop_prepare() function. The timeout value was treated as microseconds when in reality it is given in milliseconds. I wondered how we could have had a factor of 1000 error in the timeout without anyone noticing before, but I found out that PulseAudio itself never uses timeout values other than 0 and the special value -1 with pa_mainloop_prepare(), and applications probably don’t use other values either (if they even use pa_mainloop_prepare() directly – usually there’s no need for that).

This post was originally written on 2019-07-09, and first made available to my Patreon supporters. Speaking of Patreon – I’m using crowdfunding in an attempt to make it financially sustainable to continue my volunteer work as a PulseAudio maintainer. If you’d like to help, check out my Patreon page (or Liberapay).

May 2019

Last month I spent time catching up on hundreds of unread emails from GitLab (meaning bug tracker and merge request traffic). That’s nearly done, the current unread GitLab mail count is just 34. Next I plan to do the same for unread mails from the mailing list (current count is at 186). When that’s done, I can finally feel a bit more relaxed due to knowing that I haven’t missed any important mails.

It was reported that when GDM shuts down its PulseAudio instance after 30 seconds after logging in, the volume in the user’s PulseAudio instance gets reset to the volume that was last set in GDM. That’s pretty bad, because if the user changes the volume in their login session, that volume will be forgotten again after logging in the next time. I think shutting down PulseAudio after 30 seconds is new behaviour in GDM, which would explain why this serious bug didn’t get reported earlier. I couldn’t reproduce the problem at first, but that had something to do with the fact that I have a USB sound card in addition to the internal sound card. When I removed the USB sound card, I was able to reproduce the problem. I imagine this is a pretty wide-spread problem by now (although no further reports have come in). The root cause of the bug seems to be a change that was done in PulseAudio 12.0, so older versions aren’t affected. I think I know how to fix the problem, but I didn’t have time to test the fix yet.

I fixed a bug that in some rare cases prevented module-default-device-restore from remembering the user’s default sink or source selection.

One of the old mails that I went through was a report that the “Analog Surround 7.1” string was not translated while “Analog Surround 5.1” was. I thought that this would be trivial to fix, but once I had fixed that particular problem, I noticed that there are many mappings that have this same problem. The work is still in progress to make all mapping descriptions translatable. A similar problem exists for some profile descriptions, but those are not so easy to make translatable, and I’m not planning to fix them for now.

I reviewed a patch from Arun Raghavan for fixing installation paths in the Meson build system and a patch from Felipe Sateler to remove -ffast-math from the compiler options. The -ffast-math option allows the compiler to speed up floating point operations, but the option doesn’t seem to be safe to use if it’s sometimes necessary to handle weird floating point values such as infinity or not-a-number. PulseAudio has to deal with at least negative infinity, because when a volume is set to zero (i.e. muted), that gets translated to negative infinity in decibels.

I started a new hobby project: I want to make it possible to configure loopbacks (i.e. connecting a source to a sink) in pavucontrol, and for that I need a “loopback manager” module in PulseAudio. I have a keyboard (the musical kind, like a piano) connected to a sound card input and I want the audio go to the output on the same sound card. The sound card actually supports doing this directly in hardware, but then the stereo signal gets downmixed to mono, which has a surprisingly bad effect on the perceived sound quality. It’s easy to set up the loopback when you know about module-loopback and are comfortable with the command line, but I thought it would be nice to be able to do this with just pavucontrol. I’m treating this as a completely separate project (in terms of time allocation) from the usual maintainer work, so this is kind of off-topic for these monthly reports, but this is probably interesting to the audience of these reports anyway. I also reviewed some of the messaging API patches from Georg Chini, because the loopback manager will need that API.

This post was originally written on 2019-06-08, and first made available to my Patreon supporters. Speaking of Patreon – I’m using crowdfunding in an attempt to make it financially sustainable to continue my volunteer work as a PulseAudio maintainer. If you’d like to help, check out my Patreon page (or Liberapay).

April 2019

Welcome to another monthly report!

PulseAudio

I continued reviewing the A2DP codec patch series from Pali Rohár, and based on the feedback he submitted a new version of the patches. The review work continues still. Smaller reviews last month include a set of patches that fixes issues in PulseAudio’s Meson build system (unfortunately the patches had several issues themselves, so they’re not yet merged) and a fix for an ALSA header include directive, which broke due to a recent change in alsa-lib’s pkg-config file.

Another thing that consumed a significant amount of time was discussing how to handle audio filters in PulseAudio. A new equalizer implementation has been offered already a while ago, and that discussion was now revisited. Everyone wants a good equalizer solution for PulseAudio, but we the maintainers are reluctant to add more complex DSP (digital signal processing) code to the PulseAudio repository, because we’re not really qualified to maintain such code. It would be better to have the DSP code in a loadable plugin that could be maintained separately from PulseAudio. There are standards for such plugins: LADSPA and LV2 are the prominent standards for Linux, and then there’s PipeWire’s SPA that was also considered. The new equalizer implementation can be configured with flexible number of frequency bands, which would be nice to be able to take advantage of, but neither LADSPA nor LV2 support that kind of plugin configuration. PipeWire’s SPA might support it, but SPA is complex and not well documented, so nobody is currently willing to implement support for SPA plugins in PulseAudio. Currently it seems that we’ll end up defining a custom filter API in PulseAudio to be able to support the new equalizer (and of course other plugins too, if people are interested in using the new API for their plugins rather than the established standards).

OpenEmbedded

I updated the pavucontrol recipe to 4.0. I didn’t submit the patch yet, though, because when I finished the patch, the Yocto 2.7 release was in the finalizing stages, and I didn’t want to submit the update during a freeze phase (I’m not sure the meta-openembedded repository, which pavucontrol is part of, actually has any freeze rules, but I wanted to play it safe). Now that Yocto 2.7 release is out, I should submit that patch…

A couple of years ago there were some reports of the pulseaudio recipe triggering “textrel” warnings when doing hardened builds. The likely reason for the warnings is some buggy assembly code in PulseAudio. I decided to look into that, but so far I haven’t been able to reproduce the problem. I plan to do some more experiments still.

I started looking into enabling “ptests” in the pulseaudio recipe. The ptest system allows a recipe to build and install tests that can be automatically run on the target machine. PulseAudio has a limited test suite, which could be used by the ptest system.

This post was originally written on 2019-05-06, and first made available to my Patreon supporters. Speaking of Patreon – I’m using crowdfunding in an attempt to make it financially sustainable to continue my volunteer work as a PulseAudio maintainer. If you’d like to help, check out my Patreon page (or Liberapay).