PulseAudio Core Concepts


  • pa_core -- the main pulseaudio service object (can load multiple pa modules and manage current active pa_sinks and pa_sources)
  • pa_card -- audio card to provide sinks and sources (e.g. each alsa module instance provide one alsa pa_card)
  • pa_card_profile -- each pa_card defines a set of profiles, each of which describe input/output devices information (e.g. output:HDMI_stereo+input:analog_stereo is a profile, and output:analog_stereo can also be a valid profile)
  • pa_sink -- runtime output device object, only active profile's sinks are created.
  • pa_source -- runtime input device object, only active profile's sources are created.
  • pa_device_port -- runtime mixer path(some device may have audio mixer switch, e.g. same analog-output device may be switched to speaker or headset)
  • pa_sink_input -- stream data object (once a pa client playback stream is connected, a corresponding pa_sink_input is created)
  • pa_source_output -- stream data object (once a pa client record stream is connected, a corresponding pa_source_output is created)

Active sinks and sources are decided by all pa_cards' active profiles, if pa client doesn't specify the sink or source, the active sink/source with highest priority will be attached. If pa client doesn't specify the port, the mixer settings for the port with highest priority will be used.

When user(or policy manager which reacting to events like jack insert) switch the active profile, all sink_inputs and source_outputs will be reattached to new active sink/source, so that the existing audio streams will change the playback/record the devices.

PulseAudio ALSA Module


  • pa_alsa_profile -- the implementation of pa_profile for alsa
  • pa_alsa_mapping -- the description of output/input devices for alsa
  • pa_alsa_device_port -- the description of alsa mixer path (controls)

Alsa UCM Concepts


  • ucm_card -- alsa ucm card defined in card ucm configuration, may contain one or more alsa cards.
  • ucm_verb -- main device audio action. e.g. the "HiFi" use case verb will configure the audio hardware for HiFi Music playback and capture

  • ucm_device -- Physical system devices the render and capture audio. Devices can be OR'ed together to support audio on simultaneous devices
  • ucm_modifier -- runtime configuration changes to deal with asynchronous events

Mapping between PulseAudio and alsa UCM

PulseAudio without ucm


as described in the diagram, there're alsa profile configurations for pulseaudio

Current slimlogic pulseaudio ucm implementation


  • Current pulseaudio ucm is implemented in pulse alsa module, which means each alsa card will have a ucm_card instance, it's not very accurate because we only need one ucm card for system
  • In current implementation, each alsa profile is mapped to ucm_device, so that we can only use one device at the same time. Which means we can't use speaker output and microphone in simultaneously if they are different ucm devices.
  • In current implementation, if we receive a voice call while playing mp3, we can only switch profile in pa_client, which will cause mp3 stream moving from headset to earpiece. But it's not ideal because we only need voice stream to play at earpiece and keep mp3 at headset.
  • Priority of profile is not described in alsa ucm configuration, so that it's hard coded now.
  • Channel map information is missing in alsa ucm configuration, so that it's hard coded as {left, right} stereo.

Current intel pulseaudio ucm implementation

  • Concept mapping is obscure, the code is hard to understand (maybe I'm not familiar with intel HDA audio arch)
  • pa_card_profile <-> ucm_verb:modifier[,modifier2] pairs, but why?

  • Add additional concepts, not general enough and may change the original ucm concepts
    • add special modifier class "profile modifier" and "port modifier"
    • create verb <-> media role mapping

    • add dual dev support to special case play tone
  • pa_sink/pa_source depend on modifier property "_supporteddevs", but modifier is not mandatory at all

Confirmed concept mapping


  • map pa profile to ucm verb, so that it can contain multiple sinks and sources.
  • map pa_alsa_device to alsa pcm device
  • map pa_port to ucm device combination
    • not all ucm devices in same verb can be worked simultaneously, we need to handle conflicted and supported device list properly. Only valid combination are mapped.
  • map pa_stream_role to ucm modifier, that means modifier can be enabled/disabled by stream role changed
  • add channel map information in ucm device property
  • add priority in ucm verb and device property

Policy management in PulseAudio

  • dynamic priority requirements when audio devices plug in/out, so that audio stream can be created on/moved to new plugged device(plug in) or last played device(plug out)

WorkingGroups/Middleware/Multimedia/Specs/1111/AudioIntegration/UCMPulseAudio/Analyzation (last modified 2011-11-09 04:23:20)