2

When I build my app on a Pixel 2 (Oreo 8.0) I get PerformanceMode::LowLatency:

2019-06-30 15:04:15.560 8506-8506/? D/AUDIO-APP: HearSightEngine - Stream PlayStream IS low latency

2019-06-30 15:04:15.572 8506-8506/? D/AUDIO-APP: HearSightEngine - Stream Recording IS low latency

When I build my app on a Samsung S7 (Nougat 7.0) app I don't get it:

2019-06-30 14:49:30.874 20025-20025/? W/AUDIO-APP: HearSightEngine - Stream PlayStream is NOT low latency. Check your requested format, sample rate and channel count

2019-06-30 14:49:30.896 20025-20025/? W/AUDIO-APP: HearSightEngine - Stream Recording is NOT low latency. Check your requested format, sample rate and channel count

The two significant differences are

  1. AAudio is used the first case and OpenSL ES is used in the second.
  2. Pixel 2 is used in the first case, Samsung S7 is used in the second.

Does OpenSL ES support PerformanceMode::LowLatency? Or does Samsung S7 not support it? Or something else? I read the FAQ [1] and it mentioned AudioAttributes.FLAG_LOW_LATENCY for API's < 26, could something like that help me?

[1] https://github.com/google/oboe/blob/master/docs/FAQ.md

Community
  • 1
  • 1

1 Answers1

1

Only from Nougat 7.1 onwards. On previous versions of Android querying the performance mode will return PerformanceMode::None. Here's the code.

There is no programmatic way to know whether you have a low latency stream on Android 7.0 and below. You can verify it manually using adb shell dumpsys media.audio_flinger and looking for the F (for FAST track) next to your app's stream.

You can maximise your chance of receiving a low latency stream by following the guidance here.

donturner
  • 17,867
  • 8
  • 59
  • 81