oboe icon indicating copy to clipboard operation
oboe copied to clipboard

Very high latency when more than 2 audio channels are used

Open apleton opened this issue 5 years ago • 6 comments
trafficstars

Android version(s): 9/10 Android device(s): Pixel 3a, Samsung Galaxy s10 Oboe version: 1.4.2 App name used for testing: Hello Oboe

Short description On some devices the latency is very high when more than 2 channels are used.

Steps to reproduce

  • launch the sample app Hello Oboe on a device connected to a multichannel audio interface (in my case Pioneer WeGo4 or Reloop BeatPad2).
  • Latency is around 5 ms
  • Select “Channel count” : 4

Expected behavior

  • Latency is a bit higher but not too much

Actual behavior

  • Latency is around 150 ms, sometime 200 ms.

Any additional context

  • I observe the same behaviour in my app. With 2 channels, I can set a buffer size of 192 frames. But with 4 channels any buffer smaller than 2000 frames trigger underruns.
  • Moto G5 (android 8.1) does not have that problem. The latency is the same when selecting 4 channels.

apleton avatar Jul 10 '20 15:07 apleton

Thanks for letting us know about this. It sounds like on some devices when requesting a stream with 2 or less channels a low latency stream is provided, otherwise a normal (100+ ms latency) stream is provided.

What's the latency on the Moto G5 when using 4 channels? I ask because it might be that the device is not providing a low latency stream for any channel counts.

@philburk Do you know what the performance mode policy is for streams with >2 channels?

dturner avatar Jul 16 '20 13:07 dturner

With Hello Oboe app running on Moto G5, I get 22 ms latency in 2 and 4 channels configuration.

In our app, Moto G5 runs in PerformanceMode::LowLatency mode with 2 and 4 channels. I set the buffer size to 256 frames for both 2 and 4 channels configuration and it runs fine.

Note : the moto G5 runs android 8.1.

apleton avatar Jul 17 '20 12:07 apleton

I don't have an S10 to test on but I do have an S9 running Android 10 and a Pioneer DDJ-WEGO3. I tried reproducing this issue on that hardware and I found that that I cannot get a low latency stream. Even with 2 channels the latency remains at around 80ms. Changing to 4 channels didn't affect this. Neither did switching to a Pixel USB headset adapter. It appears the S9 just doesn't support low latency streams over USB audio devices.

dturner avatar Sep 16 '20 11:09 dturner

I have filed an issue with Samsung (b/168790057) so will close this here and update when there is any progress.

dturner avatar Sep 17 '20 13:09 dturner

Pixel 3a on RQ1A with 4 channels on Vantec USB interface got 1920 framesPerBurst at 96000 Hz. PerfMode=NONE

Pixel 4a 5G on S master with 4 channels on Vantec USB interface got 252 framesPerBurst at 96000 Hz. Performance mode is LOW_LATENCY but the measured round-trip latency is 93 msec. For stereo the latency is 19 msec at 48000 Hz.

philburk avatar Jan 27 '21 17:01 philburk

Pixel 6 on T with 4 channels doesn't use MMAP and ends up with a burst of 960 and a tap to tone latency of 114ms. @philburk can add more than 2 channels to AAudio?

robertwu1 avatar Apr 22 '22 00:04 robertwu1