client-sdk-android
client-sdk-android copied to clipboard
Inconsistent echo behavior on certain android devices
Reported in Slack community.
I’m playing a lot with RoomOptions.audioTrackCaptureDefaults flags and with LiveKitOverrides.javaAudioDeviceModuleCustomizer (to set UseHardwareAcousticEchoCanceler and UseHardwareNoiseSuppressor). Sometimes I find combination that seems to solve the problem, but the flags configurations end up being completely different on every device I try. On some other devices I don’t find a working configuration at all.
Examples
- Samsung S8 (with Android 9): this one generates echo for all the other participants in the room if the audioTrackCaptureDefaults are true, but it doesn’t if they are false
- pixel 2 we need to enable hardware cancellation not to get echoes & audio artifacts (by setting UseHardwareAcousticEchoCanceler to true in the audio module)
Hello! I think I managed to solve it for all my use cases/devices by not touching the audioTrackCaptureDefaults and only tweaking the setUseHardwareAcousticEchoCanceler() in the JavaAudioDeviceModule. I connect by doing something like this:
LiveKit.connect(
context, url, token,
roomOptions = RoomOptions(adaptiveStream = true),
overrides = LiveKitOverrides(
javaAudioDeviceModuleCustomizer = { builder ->
val useHardwareAudioProcessing = Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q
builder.setUseHardwareAcousticEchoCanceler(useHardwareAudioProcessing)
.setUseHardwareNoiseSuppressor(useHardwareAudioProcessing)
}
)
)
@symphonybiz If it's not too much trouble, could you list the devices this worked on?
Sure:
- Samsung Galaxy S8 (Android 9)
- Pixel 2 (Android 11)
- Sony Xperia Z5 Compact (Android 7)
- Xiaomi Mi 9T (Android 11)
@symphonybiz how did you get echo to reproduce? Is this by holding two devices close to each other so they are picking up each other's feedback?
@davidzhao no, actually the opposite. I put one in a different room.
I encountered 2 types of "echo": one is basically a single repetition of what's being said coming back from the offending device, while the other is a very noisy feedback loop. From the Samsung s8 I would get the first type, while from the Sony Xperia I would get the other.
@symphonybiz just to confirm, the proposed solution is to turn on the hardware cancellers in devices Q and above?
This issue seems to imply the opposite, so just want to confirm.
yes @davidliu this is what it seems to work for us: disabling HW cancellation on < API 29
@davidliu from my POV this can be closed, because we're using the javaAudioDeviceModuleCustomizer customization above and have no problems now