← Back to team overview

ubuntu-phone team mailing list archive

Re: Ubuntu Touch Audio stack for 13.10 release

 

Just another heads up, due the PulseAudio transition:

1 - Hardware video decoding will stop work as that needs the Android
media service to be up, including AudioFlinger, which had to be
disabled for Pulse to be the main sound server. This will be fixed
once we land the work Jim is doing to get proper hardware video
decoding/rendering using Gstreamer (with hybris and libstagefright).
2 - The video recording feature will also not work anymore, as that
was also using the Android media service for audio/video recording.
This will also be replaced with Gstreamer, but we're still not sure if
it'll be ready for 13.10.

Besides that, please let us know about any possible audio issue you
might face when using Galaxy Nexus and Nexus 4, while we enable the
other devices (such as Nexus 7 and 10). Galaxy Nexus and Nexus 4 are
our priority as they are used as real phones, so phone call needs to
work reliably :-)

Cheers,

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


References