← Back to team overview

ubuntu-phone team mailing list archive

Re: Ubuntu Touch Audio stack for 13.10 release

 

My test results:

Nexus 4:
- Indicator
  - Mute working
  - Volume working
- Aplay works
- Video with software decoding works
- Music Player works fine with wav and mp3 (but for mp3 you need to
install gstreamer0.10-plugins-ugly)
- Phone:
  - Receive works
  - Making call works
  - Ringtone works
  - Speakerphone works
  - Unecessary setmode INCALL/NORMAL when declining a call :
http://paste.ubuntu.com/6034445/
- Jack detection:
  - Working but sound coming from both jack and speaker (also just
coming sound from the left side, not stereo, but might be my cable)

Galaxy Nexus:
- Boot, exception stack when starting pulse: http://paste.ubuntu.com/6034603/
- Indicator
  - Mute working
  - Volume working
- Aplay working, but very low volume by default (handsfree, earpiece
and headset volume seems to be 0% by default, in alsamixer)
- Phone:
  - Make and Receiving fails: http://paste.ubuntu.com/6034612/
    - Not necessarily related, but opened
https://bugs.launchpad.net/ubuntu/+source/linux-maguro/+bug/1217618
  - Ringtone works (low volume)

So it seems that with Maguro we might still need some UCM changes, but
also need to identify why the kernel is giving the exception stacks at
every boot.

Thanks,

Ricardo

On Tue, Aug 27, 2013 at 9:14 AM, David Henningsson
<david.henningsson@xxxxxxxxxxxxx> wrote:
> Up until now, we've been using Android's AudioFlinger for playing back
> and recording audio. Starting with tomorrow's image, that is no longer
> true. Instead we're talking directly from PulseAudio to ALSA, or the
> Android audio HAL when necessary.
>
> In short, here's how PulseAudio now works:
>  * For normal playback and recording, PulseAudio talks directly to
> alsa-lib, just as on the desktop.
>  * For detecting whether a headphone/headset is plugged in or not,
> PulseAudio now has code for reading that from the Android kernel,
> through the "switch" interface [1].
>  * For normal mixer setup, we use ALSA UCM [2] mixer files.
>  * For setting up voice calls, we talk to the Android Audio HAL through
> a PulseAudio module.
>
> This provides somewhat of a compromise between features and porting
> effort: By using the ALSA library whenever we can, we can access
> PulseAudio's timer scheduling and dynamic latency features. Having the
> straightest path possible for playing back music should help efficiency
> (and in extension, battery life). At least in theory - we haven't
> actually done measurements.
>
> Using the Audio HAL for everything mixer related would have been
> optimal, but it turns out that the audio HAL is too smart: it refuses to
> set up the mixer, unless PCM data is also sent to it, which is what we
> wanted to avoid. So then we had to set up the mixer manually too.
> However, we still could not avoid using the Audio HAL altogether: when
> starting and stopping voice calls, the Audio HAL talks to the modem and
> other components in the kernel to route the voice call between the modem
> and the sound card. Hence we ended up with this compromise approach.
>
>  == Current status ==
>
> At the time of this writing, this is working best on Nexus 4. The Galaxy
> Nexus works for the most part, except for bug 1217072. I intend to add
> Nexus 7 support shortly. If anyone wants to help testing Nexus 10, let
> me know.
>
>  == For porters: if you need to do the same ==
>
> Unfortunately, this means some additional work for porters, because you
> need to write UCM mixer files. What's worse, UCM is lacking good
> documentation. For that reason, I hesitated somewhat before deciding to
> actually use UCM at all, but it's the closest we have to a standard for
> setting up mixers on embedded devices right now.
>
> But to give you a two-minute crash course in UCM and how it's used in
> Ubuntu Touch - start by having a look in
> /usr/share/alsa/ucm/apq8064-tabla-snd-card/ directory (shipped with
> alsa-lib). You'll need to create a similar directory for your device.
> You'll find the right directory name if you look in /proc/asound/cards.
>
> Second, look at apq8064-tabla-snd-card.conf. Rename and copy into your
> own UCM directory. If you're making a tablet image (that can't make
> voice calls), you can remove the VoiceCall part (and the corresponding
> file).
>
> Third, look at the HiFi file. This is where all fun happens. Notice the
> device names, which are hardcoded into telepathy-ofono and need to
> match: "Speaker", "Earpiece" and "Headphone" for playback, plus
> "Handset" and "Headset" for recording.
>
> Fourth, if you need voice calls, also look at the VoiceCall file. Btw,
> the verb names "HiFi" and "VoiceCall" also need to match.) This is
> largely empty, because the mixer setup is handled by the Audio HAL, but
> there is a twist here that took a while to get right: For PulseAudio's
> UCM to work, it needs to open a PCM device. However, at the time where
> UCM tests this, the voice call is not yet set up. So, you might need to
> set up the mixer just a little, so that the PCM can open. (On desktops,
> PCM can always open, regardless of mixer state. This is not always true
> on embedded devices, that are using ASoC.) It's a bonus if you can find
> a PCM that actually plays back audio, because then you can get
> notification sounds while on the phone.
>
> And this concludes the two minute crash course - happy porting!
>
> (Side note: This has also been posted on my blog, but the blog link [3]
> currently leads you to a blank page. I've reported the bug to the
> relevant team in Canonical, but at the time of this posting, they have
> not yet fixed it.)
>
> --
> David Henningsson, Canonical Ltd.
> https://launchpad.net/~diwic
>
> [1] http://lwn.net/Articles/493302/
> [2] http://www.alsa-project.org/main/index.php/Use_Case_Manager
> [3]
> http://voices.canonical.com/david.henningsson/2013/08/27/ubuntu-touch-audio-stack-for-13-10-release/
>
> --
> Mailing list: https://launchpad.net/~ubuntu-phone
> Post to     : ubuntu-phone@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~ubuntu-phone
> More help   : https://help.launchpad.net/ListHelp



-- 
Ricardo Salveti de Araujo


Follow ups

References