Ticket #1841 (closed task: wontfix)

Opened 2 years ago

Last modified 15 months ago

Review Android audio output latency

Reported by: nanang Owned by: nanang
Priority: normal Milestone: release-2.5
Component: pjmedia-audiodev Version: trunk
Keywords: Cc:
Backport to 1.x milestone: Backported: no

Description

Change History

comment:1 Changed 15 months ago by nanang

  • Status changed from new to closed
  • Resolution set to wontfix

After some research, here are some points about Android audio device latency:

  1. It seems that the latency is introduced mainly in the OS layers, see ref 1 and 2.
  2. Fast Mixer path is available (provided by Android), but it seems that most device vendors do not include it, see ref 3 and 4
  3. Application may try to optimize latency using some quite complex methods, e.g: priority inversion and non-blocking algo, see ref 5, moreover it seems to be dependent to a hardware feature, i.e: android.hardware.audio.low_latency (perhaps it is the Fast Mixer path)
  4. Devices with recent/latest Android version seem to have relateively low audio latency, e.g: generally Android 5 or later have much less than 100ms round-trip latency, see ref 6 and 7.

Implementing the method described in ref 5 in point c above are considered not so effective, e.g: it requires some rather big effort (some steps are quite complex), may only work on few devices, and may not work as expected, note that non-blocking algo possibly requires additional threading (encoding, etc, are blocking operations) and buffering introduced in pjmedia, so more latency will be introduced.

Tried to use superpowered SDK audio device wrapper (open source), but it doesn't work very well too, for example no indication of using Fast Mixer, hardcoded to stereo mode.

So for now, with the good news described in point d above, hopefully people is in hurry upgrading OS or even devices (just as iOS users ;) and latency would be no longer an issue.

References:

  1. https://source.android.com/devices/audio/latency_design.html
  2. http://superpowered.com/androidaudiopathlatency
  3. http://superpowered.com/androidaudiopathlatency : "Apart from the most recent Nexus models, most other manufacturers do not configure Android to support Fast Mixer, hence round-trip latency is significantly higher on those devices"
  4. http://superpowered.com/low-latency-audio-android-ios
  5. https://source.android.com/devices/audio/latency_app.html
  6. https://source.android.com/devices/audio/latency_measurements.html
  7. http://superpowered.com/latency
Note: See TracTickets for help on using tickets.