October 2016

Here’s my second monthly report about my PulseAudio activity (there’s not really anything to report on the OpenEmbedded front this time). We’re preparing for the 10.0 release, which means that I should concentrate on getting rid of the release blocker bugs, but actually I ended up doing some other things too.

Another default device handling improvement

I continued to work on the bug about HDMI being preferred over headphones (it should be the other way around). In September I made patches that set the headphone sink as the default when headphones are plugged in, now I made a patch that also moves existing streams to the headphones. So if the user hasn’t explicitly chosen a sink for a stream, such streams now automatically move when the default sink changes. I’m happy this is finally fixed (the patches still are pending review, though), now I think the only major remaining issue with our default device handling is that if the user sets a USB device as the default, that choice is forgotten if the device is removed and plugged in again later.

module-combine-sink crash

Another major work item was bug 95352, which is about a crash when using module-combine-sink. It’s great that we got a backtrace from the bug reporter, because trying to reproduce the problem would be very hard. Based on the backtrace, I’m pretty confident I know why the crash happens, and I’ve been working on a fix. The fix requires relatively big changes, and my first idea didn’t work as well as I expected, so it will take some time to finish it.

The problem is basically that when a client exits, the shared memory associated with the client is freed, and if there’s some part of the system still using a “memblock” that references that memory area, the memory is copied from the shared memory to a local memory pool in the server. This copying involves changing the “type” of the memblock. However, there’s code that assumes that the memblock type won’t change, and if such code runs at the same time the memblock type is being changed, a crash happens. One option would be to remove the incorrect assumptions by adding more locking to the memblock code, but that could cause performance problems and it would also increase the complexity of the memblock code that I think is complex enough already. My current plan is to get rid of the memblock type changes instead. There should be no need to forcibly free the shared memory area that is associated with a disconnecting client, so the memblock type change should be avoidable. There’s also a different situation where the memblock type changes, but I have a plan for getting rid of that too.

module-bluetooth-policy crash

The new feature in module-bluetooth-policy for automatic switching beween A2DP and HSP turned out to cause crashing if there are no other sources in the system than the HSP source. I made a fix for that, but the fix then made module-suspend-on-idle crash due to an old bug that just hadn’t been triggered before. I fixed that too.

Patreon launch

Preparing for the Patreon launch took a significant chunk of time. In particular, deciding what to say in the introduction pitch on the main Patreon page and how to say it was a slow process. Whatever I wrote, it never seemed to be quite right. Well, now I’m finally reasonably happy with the page, and the campaign is live! It has been about a week now since the launch, and the results are better than what I expected – big thanks to all of you who signed up already!

Other things

Thanks to investigating bug 97064, I learnt that I can comfortably blame the kernel or hardware configuration for a certain class of Bluetooth audio problems: if PulseAudio successfully creates a sink and source for HSP, but no audio gets transmitted, the reason may be missing firmware or the Bluetooth adapter may be in a wrong mode.

We have an annoying dependency on GConf due to paprefs, but Sylvain Baubeau has done some work to move paprefs to GSettings. There was initially some unclarity about how to cleanly manage the transition so that the existing settings stored in GConf are preserved, but now it’s starting to look much clearer: we’ll probably ship PulseAudio with both GConf and GSettings enabled by default, and then a bit later update paprefs. The first time the new version of paprefs is run, the settings in GConf get moved to GSettings. At some point in the future we can then drop GConf support from PulseAudio.

I also wrote a few miscellaneous small patches, here’s a list:

  • a patch for allowing Chinese characters (or anything else in UTF-8) in Bluetooth device descriptions.
  • a patch that removes the use of readdir_r(), which glibc has recently deprecated.
  • a couple of patches for making the system.pa configuration file more similar to default.pa. Some modules were loaded in the wrong order, causing volume restoring to not work properly. It seems that the system mode configuration has been severely neglected over the years, and there would still be work to be done to make the configuration more similar to the normal per-user mode (the configuration files can’t be exactly the same, though – there’s a reason why system.pa and default.pa are separate files).
  • a fix for a small error in threaded mainloop example code.
  • a fix for a minor bug found by Coverity: we didn’t always check the return value of dbus_message_iter_append_basic(). The function can in theory fail due to lack of memory.

I think that’s all for now. Thanks for reading!

This post was originally written on 2016-11-01, 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.

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s