From 05a85911101bdf3f719745bdded4b21e4e6c86b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sa=C3=BAl=20Ibarra=20Corretg=C3=A9?= Date: Wed, 11 Mar 2020 14:58:42 +0100 Subject: [PATCH] android: make sure all AudioMode operations run in the audio thread --- .../org/jitsi/meet/sdk/AudioModeModule.java | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/android/sdk/src/main/java/org/jitsi/meet/sdk/AudioModeModule.java b/android/sdk/src/main/java/org/jitsi/meet/sdk/AudioModeModule.java index b579d86d8..4e1f08c64 100644 --- a/android/sdk/src/main/java/org/jitsi/meet/sdk/AudioModeModule.java +++ b/android/sdk/src/main/java/org/jitsi/meet/sdk/AudioModeModule.java @@ -198,7 +198,12 @@ class AudioModeModule extends ReactContextBaseJavaModule { */ @Override public void initialize() { - setAudioDeviceHandler(); + runInAudioThread(new Runnable() { + @Override + public void run() { + setAudioDeviceHandler(); + } + }); } private void setAudioDeviceHandler() { @@ -292,9 +297,14 @@ class AudioModeModule extends ReactContextBaseJavaModule { * @param use Boolean indicator of where it should be used or not. */ @ReactMethod - public void setUseConnectionService(boolean use) { - useConnectionService_ = use; - setAudioDeviceHandler(); + public void setUseConnectionService(final boolean use) { + runInAudioThread(new Runnable() { + @Override + public void run() { + useConnectionService_ = use; + setAudioDeviceHandler(); + } + }); } /**