September 2016

Here’s my first monthly summary! Last month I made the decision to start a Patreon campaign, and the first concrete action towards that was to start writing notes every day about things I did, because it was clear from the beginning that monthly reports would be a part of the campaign, and there was no way I could write them without notes. So, let’s see what the notes say…

The loopback patches

The month began with reviewing the last few loopback patches from the big patch set that I had started reviewing already a while ago. Georg Chini has been working on them for a long time, this was already the sixth iteration. The patches include many improvements, my favourite is that module-loopback shouldn’t any more accumulate huge latencies if the audio consuming device (speakers) is for some reason slow to start. It’s also nice that it’s now much clearer to me how the dynamic sample rate regulation works in principle. Previously even the basic logic was unclear to me, now it works simply by measuring the end-to-end latency every now and then, and if it’s something else than desired, the sample rate is adjusted accordingly. The specifics of the regulator still go above my head, but according to Georg’s measurements, the latency should be very stable, and the new regulator should work much better than the old one.

Some of the patches were accepted, but most of the good stuff will have to wait until Georg submits the seventh iteration.

Improving default device selection

I decided to tackle bug 93006 (“headphone output is not preferred over HDMI”), even though there are release blocker bugs open and this was not one of them. I try to make occasional contributions to OpenEmbedded(/Yocto) beyond just the routine package updates, and this kind of falls into that category. My understanding is that the bug was found as part of the Yocto project’s QA process. The bug probably isn’t a serious problem for the Yocto folks, but I was motivated to fix it anyway (the problem is certainly not some weird corner case that would only affect Yocto).

So the problem was that the default sink was chosen badly. Headphones should be preferred over HDMI by default. Sinks have a priority value assigned to them, and the priorities are used to determine which sink is the default. Obviously there was something wrong with the priorities.

Headphone and HDMI output priorities are actually associated with ports, not sinks. The headphone port already has a higher priority than the HDMI port, so that was not the issue, but when the default sink is chosen, only sink priorities matter and the port priorities are ignored. I figured that there’s no need to have separate priorities for sinks and ports, so I changed things so that the sink priority is always the same as the priority of the active port. If a sink has multiple ports, the sink’s priority changes when changing the port.

My patches haven’t been reviewed yet, which means that the fix won’t be in the upcoming 10.0 release.

There’s still the problem that if the default sink changes, existing streams don’t get automatically moved to the new default sink (except when using Gnome’s sound settings application). So in the case of HDMI and headphones, my patches fix things so that after headphones are plugged in, new streams will correctly be routed to headphones, but it’s still so that streams that play to HDMI at the time when headphones are plugged in don’t get automatically moved to headphones. I plan to fix this during this month. This behaviour has annoyed me for a long time, so I’m excited to finally make it right.

Enabling memfd by default

PulseAudio 9.0 got the ability to use memfd for shared memory, but the feature wasn’t enabled by default. We want to enable it in 10.0, so I made a simple patch for that. Phoronix created a news story about that, which seemed funny, because users won’t notice any change (with the exception of firejail users, since firejail isn’t compatible with PulseAudio’s old shared memory mechanism). I guess it’s kind of newsworthy, though, since it’s a step towards really useful stuff like safe audio access for untrusted sandboxed applications.

Unfortunately, a serious problem was found relating to memfd. It turned out that 32-bit applications don’t work with 64-bit server if memfd is enabled. This is considered a release blocker bug, so either this will be fixed, or memfd can’t be enabled by default after all. The bug report is here: 67769.

Squashing release blocker bugs

I made some good progress on fixing the bugs that are blocking the 10.0 release. The master branch was frozen on 2016-09-22, but there’s no release candidate yet, because some release blocker bugs are still lacking a fix. Here are the bugs that got attention from me last month:

The new openssl 1.1.0 release is not compatible with code that was written against older versions, so I had to make some changes in module-raop-sink to make it compatible with both old and new openssl versions. It seems weird that an established project like openssl does something like this – libraries should in principle never break compatibility in this way, but I’d guess there was some very good reason for this. I expect distributions to have a lot of fun with transitioning all software to the new openssl version. At least PulseAudio is ready for that transition.

Running out of file descriptors makes the server crash. Fix submitted.

module-rtp-recv crashes when receiving an eight-channel audio stream. Fix submitted.

On some systems unloading a module also removes the module from the memory, which causes crashing if a module unloads itself (this has happened at least with module-bluez5-device). I submitted a fix that makes it safe for a module to unload itself.

The new automatic switching of bluetooth profiles makes the server crash if the bluetooth headset is the only audio device in the system. I started to investigate this, but at the time of writing I don’t have a fix, or even know why the crash happens.

libsamplerate update

On Monday 2016-09-19 the OpenEmbedded recipe reporting system reported that libsamplerate had got a new release (the first new release in years, by the way). That was surprising, since I’m on the libsamplerate mailing list and there was no release announcement (the recipe reporting system found out about the release by monitoring the libsamplerate download page). Nevertheless, I started the usual package update process.

The new release has a new optional dependency on alsa-lib, but the configure script warned about unsupported options when trying to enable or disable the alsa code. Those warnings turned out to be harmless, but I anyway submitted a fix for the configure script to get rid of the warnings.

The current status is weird. I have the package update ready for OpenEmbedded, but the new release has been removed from the libsamplerate web site. The release seemed a bit unfinished from the very start, so I guess the libsamplerate maintainer decided to pull the new release until he has time to do the release properly. The maintainer was travelling last week, but I’d expect something to happen this week.

Miscellaneous patch reviews

Sylvain Baubeau: “Use local icon for zeroconf shared devices” – This improves (in some situations) the device icon shown in GUIs for remote devices. Accepted.

Sylvain Baubeau: “module-gsettings: new module to store configuration using gsettings” – This helps us get rid of the gconf dependency of paprefs (gconf is a dead project). I didn’t review the code in detail, because it was very unclear how the data transition is supposed to be done without causing trouble for paprefs users with old configuration stored in gconf. The discussion is still ongoing, but I expect this to move forward soon.

Jan Steffens: “launch: Remove the already implicit After=pulseaudio.socket” – Cleanup for our systemd service file. Accepted.

Marcin Lewandowski: “core-util: log error if we hit file descriptors limit” – Accepted.

Pali Rohár: “bluetooth: Add support for automatic switch between hsp and a2dp profiles also for bluez5” – PulseAudio 10.0 will have a new feature for automatically switching bluetooth headsets to HSP mode when starting a VoIP call. I haven’t tested this myself, but I hope that this will be a big usability improvement for people that use bluetooth headsets for VoIP calls. This particular patch just adds bluez5 support, because at first this was supported only with bluez4. Accepted.

Pali Rohár: “bluetooth: bluez5: Add profile name to sinks and sources” – This makes A2DP and HSP volumes separate. I hope that’s a good thing. Accepted.

Deepak Srivastava: “xen: Fixed possible memory leak.” – Accepted.

Philip Withnall: “zeroconf-discover: fix a memory leak” – Accepted.

Other things

As usual, some of my time went to responding to questions on the mailing list bug tracker and IRC.

Setting up Patreon and the blog took a significant chunk of time, more than I expected. I expected to launch in September, but I still have things to do before that can happen.

I upgraded my “desktop” computer, a Raspberry Pi 2, from the old Wheezy based Raspbian to the newest release. As was recommended, I did the upgrade by installing the system from scratch. There were some issues with setting up the keyboard layout, so I got an opportunity to contribute to a new project – I submitted a fix for raspberrypi-ui-mods.

Last words

This turned out to be a rather lengthy post. This whole monthly summary thing is new to me – did you like the format? Should there be more or less detail? Would it be better to write two posts per month so that the individual posts would be shorter? Let me know in the comments.

This post was originally written on 2016-10-03, and first made available to my Patreon supporters. In the future these monthly reports will appear on my blog with much less delay than this one. 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.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s