News for hackers. Stuff that matters.
Re:Android’s 10 Millisecond Problem explained by madez on Thursday April 16, 2015 @08:05AM (#9387313)
The latency problems arise with ALSA (mostly hardware-independent) and AudioFlinger (totally hardware-independent).
Re:Android’s 10 Millisecond Problem explained by kllrnohj on Thursday April 16, 2015 @03:41PM (#9390320)
That's technically correct but an extremely inaccurate summary.

The reason ALSA and AudioFlinger add latency is to hide hardware-dependent differences as well as kernel-caused scheduling issues & policy decisions.

To achieve low-latency you need real-time scheduling, something Linux has with SCHED_FIFO but it's a bit kludgy, and getting the policy right on that is tricky (obviously you don't want a random app to be able to set a thread to SCHED_FIFO and preempt the entire system). So you have to restrict the CPU budge of a SCHED_FIFO thread, and you have to only allow apps to have a single SCHED_FIFO thread. But how much CPU time you give it needs to depend on the CPU's performance in combination with the audio buffer size that the underlying audio chip needs (and those chips also have different sample rates, is it 44.1khz or 48khz or etc...).

tl;dr: this is insanely hardware-dependent.

Re:Android’s 10 Millisecond Problem explained by szantog on Thursday April 16, 2015 @09:34AM (#9387784)
ALSA is super. The HAL connecting ALSA to AudioFlinger is the major problem, plus the audio stack's "push" philosophy.