From Fedora Project Wiki
Line 19: Line 19:
The PulseAudio rewrite is mostly complete, but glitch-free exposes a number
The PulseAudio rewrite is mostly complete, but glitch-free exposes a number
of issues in the Alsa drivers: http://pulseaudio.org/wiki/AlsaIssues
of issues in the Alsa drivers: http://pulseaudio.org/wiki/AlsaIssues
Remaining tasks:
* Fix Alsa drivers
* Add global switch to turn off timer-based scheduling


== Detailed Description ==
== Detailed Description ==

Revision as of 22:19, 16 July 2008

Glitch-free Audio

Summary

The PulseAudio sound server has been rewritten to use timer-based audio scheduling instead of the traditional interrupt-driven approach. This is the approach that is taken by other systems such as Apples CoreAudio and the Windows Vista audio subsystem and has a number of advantages, not the least in reduced power consumption.

Owner

Current status

  • Targeted release: Fedora 10
  • Last updated: 2008-07-16
  • Percentage of completion: 50%

The PulseAudio rewrite is mostly complete, but glitch-free exposes a number of issues in the Alsa drivers: http://pulseaudio.org/wiki/AlsaIssues

Remaining tasks:

  • Fix Alsa drivers
  • Add global switch to turn off timer-based scheduling

Detailed Description

Lennart has written a great explanation of the technical details here .

Benefit to Fedora

Lennarts writeup has a detailed discussion of advantages (and disadvantages) of the glitch-free approach. Some highlights are:

  • Less wakeups, reduced power consumption
  • Dynamic latency adaption
  • Less dependent on audio hardware
  • Minimized chance of drop outs

Scope

The feature requires a pretty-much rewritten core of PulseAudio.

Test Plan

  • Play sound on the desktop in various ways, e.g. music in rhythmbox, or a video in totem, or some flash video in firefox. Verify that the sound experience is the same as on F9.
  • While doing the above, run powertop and observe that pulseaudio is not increasing the power consumption as much as it used to.
  • Repeat the above with different sound cards

User Experience

Unfortunately not much of this is directly visible. The location where this is best visible is powertop.

Dependencies

The glitch-free logic will only be enabled on mmap()-capable ALSA devices and where hrtimers are available. The non-glitch-free logic will be preserved as compatibility code with older kernels and limited sound hardware or drivers.

From Lennarts writeup:

  • System timers on Unix are not very high precision. On traditional Linux with HZ=100 sleep times for timers are rounded up to multiples of 10ms. Only very recent Linux kernels with hrtimers can provide something better, but only on x86 and x86-64 until now. This makes the whole scheme unusable for low latency setups unless you run the very latest Linux. Also, hrtimers are not (yet) exposed in poll()/select(). It requires major jumping through loops to work around this limitation.
  • Generally, this works reliably only on newest ALSA, newest kernel, newest everything. It has pretty steep requirements on software and sometimes even on hardware.

Contingency Plan

If the glitch-free PulseAudio exhibits glitches that cannot be fixed in time for F10, we can just revert to the last 'traditional' PulseAudio release.

To limit the problems with Alsa drivers, there should be a switch in the PulseAudio configuration that allows to turn off timer-based scheduling.

Documentation

Lennarts detailed explanation is here: http://0pointer.de/blog/projects/pulse-glitch-free.html

Release Notes

The PulseAudio sound server has been rewritten to use timer-based audio scheduling instead of the traditional interrupt-driven approach. Timer-based scheduling may expose issues in some Alsa drivers. To turn timer-based scheduling off, use the configuration switch...TBD