Audio

Overview

This page describes the audio architecture of Ubuntu Touch and outlines several details.

Involved components

  • pulseaudio
  • Android Audio HAL
  • telepathy-ofono
  • bluez
  • indicator-sound
  • ubuntu-system-settings

General audio architecture

Pulseaudio includes a module to use the Android Audio HAL layer to deal with audio in a generic way on Android based devices. We've forked the upstream project from Jolla at some point and added some additional features like earphone hotplug etc.

All management of the things exposed by Pulseaudio is currently done by telepathy-ofono. It keeps control over which output and input are selected for audio. It also switches the necessary bits to enable support for voicecalls or to enable HFP when available.

Ubuntu Touch - Audio Architecture Overview.png

Call Audio routing

When a call comes in basically three components are involved into this for audio routing:

  • ofono
  • telepathy-ofono
  • pulseaudio

The following sequence diagram gives a short overview of what happens when a call comes in and is picked up by the user.

Call Audio Routing.png

HFP Audio Setup

For HFP audio setup the following components are involved:

  • ofono
  • telepathy-ofono
  • pulseaudio
  • bluez

The procedure to setup HFP looks like this

  1. At system startup ofono registers a profile handler for HFP with bluez
  2. When a HFP profile is connected the actual connection setup is done by ofono but triggered by bluez through the registered profile handler
  3. PulseAudio waits for a bluetooth device with HFP support gets connected and then export a card object for it which has three possible profiles to select from: a2dp_sink, headset_head_unit, off

  4. PulseAudio registers itself as a HandsfreeAudioAgent with ofono to know when a connection should be established

  5. Once a service level connection for HFP between both sides is established ofono exports a org.ofono.HandsfreeAudioCard instance

  6. When a call comes in telepathy-ofono sets the headset_head_unit profile for the available bluetooth audio card
  7. Once the headset_head_unit profile is set as active PulseAudio calls org.ofono.HandsfreeAudioCard.Connect which establishes the SCO connection with the remote side

  8. Once ofono has established the SCO connection it hands over a file descriptor to PulseAudio by calling the NewConnection method of the registered object which implements the org.ofono.HandsfreeAudioAgent interface.

  9. Once PulseAudio gets the file descriptor for the SCO handed over it streams all audio on that channel.

  10. When the call with the remote party is over telepathy-ofono switches the profile of the PulseAudio card back to a2dp_sink or off which thne causes PulseAudio to call org.ofono.HandsfreeAudioCard.Disconnect which closes the whole SCO connection to the remote side

Touch/Audio (last edited 2015-11-25 07:15:54 by morphis)