← Back to team overview

ubuntu-phone team mailing list archive

QAudioRecorder does not work properly under confinement

 

I recently wrote a small application[1] to spot an ancient issue I had using QAudioRecorder[2] on Ubuntu devices.

Specifically, it seems that applications are not able to access to any audio source available on the device, and for that reason QAudioRecorder::record() fails.

First of all, I've asked to some people that own an official supported device if they can reproduce the bug, and the answer was affirmative.

I then started some tests on my Nexus 5 (utopic-devel-proposed #185), on the i386-ubuntu-emulator (utopic-devel #206) and on my pc (Ubuntu 14.10). The test application I used is set to run under confinement, and use the following security policies: networking, audio and microphone.

In the first test I checked for some denials from apparmor (using 'dmesg | grep DEN'), but I found no denial.

Then I started to take a look to the available audio sources on emulator and my N5 and I've seen that only "default:" was available (on PC there are also 'pulseaudio:' and all the sources from ALSA). This is the first strange behaviour I found: after I took a look to the 'microphone' policy, I expected to find at least 'pulseaudio:' on my device.

After a comparison between the installed packages on my PC and my smartphone, I found that gstreamer0.10-pulseaudio was missing. I installed it on the device, and finally I got 'pulseaudio:' in the list of available sources.

I tried to start a recording, but QAudioRecorder still failed.
I got this output on my console: "shm_open() failed: Permission denied"

I changed the apparmor profile[3], so that my app has been launched in a unconfined environment: I supposed that the shared memory was confined for security issue.

So finally I got QAudioRecorder working as expected.

It seems there are actually two issues:
1) gstreamer0.10-pulseaudio is not available on Ubuntu devices. I don't know the reasons for that, but it would seem to give problems to QAudioRecorder. 2) 'microphone' security policy is too strong, and does not allow QAudioRecorder to work properly.

I wrote a mail here, since I'm not sure for which packages I should fill a bug report.

Cheers,
Stefano.


[1] - http://bazaar.launchpad.net/~verzegnassi-stefano/+junk/recorder-test/files
[2] - http://qt-project.org/doc/qt-5/qaudiorecorder.html
[3]
{
    "policy_version": 1.2,
"template": "unconfined",
    "policy_groups": []
}



Follow ups