From c4abd274e834c7c63bf9f372f243e98ee97bec05 Mon Sep 17 00:00:00 2001 From: Mario Jr <mariogasparoni@gmail.com> Date: Fri, 2 Jul 2021 12:51:00 -0300 Subject: [PATCH] feat(audio): add option for enabling/disabling kms's trickle for mic --- .../ui/services/audio-manager/index.js | 20 +++++++++++++++++-- .../private/config/settings.yml | 9 +++++++++ 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/bigbluebutton-html5/imports/ui/services/audio-manager/index.js b/bigbluebutton-html5/imports/ui/services/audio-manager/index.js index 4efe730cc9..972cefcc6a 100755 --- a/bigbluebutton-html5/imports/ui/services/audio-manager/index.js +++ b/bigbluebutton-html5/imports/ui/services/audio-manager/index.js @@ -11,6 +11,7 @@ import iosWebviewAudioPolyfills from '/imports/utils/ios-webview-audio-polyfills import { monitorAudioConnection } from '/imports/utils/stats'; import AudioErrors from './error-codes'; import {Meteor} from "meteor/meteor"; +import browserInfo from '/imports/utils/browserInfo'; const STATS = Meteor.settings.public.stats; const MEDIA = Meteor.settings.public.media; @@ -20,6 +21,8 @@ const MAX_LISTEN_ONLY_RETRIES = 1; const LISTEN_ONLY_CALL_TIMEOUT_MS = MEDIA.listenOnlyCallTimeout || 25000; const DEFAULT_INPUT_DEVICE_ID = 'default'; const DEFAULT_OUTPUT_DEVICE_ID = 'default'; +const EXPERIMENTAL_USE_KMS_TRICKLE_ICE_FOR_MICROPHONE = Meteor.settings + .public.app.experimentalUseKmsTrickleIceForMicrophone; const CALL_STATES = { STARTED: 'started', @@ -110,12 +113,21 @@ class AudioManager { } async trickleIce() { - if (!this.listenOnlyBridge) return []; + const { isFirefox, isIe, isSafari } = browserInfo; + + if (!this.listenOnlyBridge + || isFirefox + || isIe + || isSafari) return []; if (this.validIceCandidates && this.validIceCandidates.length) { + logger.info({ logCode: 'audiomanager_trickle_ice_reuse_candidate' }, + 'Reusing trickle-ice information before activating microphone'); return this.validIceCandidates; } + logger.info({ logCode: 'audiomanager_trickle_ice_get_local_candidate' }, + 'Performing trickle-ice before activating microphone'); this.validIceCandidates = await this.listenOnlyBridge.trickleIce() || []; return this.validIceCandidates; } @@ -145,7 +157,11 @@ class AudioManager { return this.onAudioJoining.bind(this)() .then(async () => { - const validIceCandidates = await this.trickleIce(); + let validIceCandidates = []; + if (EXPERIMENTAL_USE_KMS_TRICKLE_ICE_FOR_MICROPHONE) { + validIceCandidates = await this.trickleIce(); + } + const callOptions = { isListenOnly: false, extension: ECHO_TEST_NUMBER, diff --git a/bigbluebutton-html5/private/config/settings.yml b/bigbluebutton-html5/private/config/settings.yml index 8e6918b8da..462f9dc9d0 100755 --- a/bigbluebutton-html5/private/config/settings.yml +++ b/bigbluebutton-html5/private/config/settings.yml @@ -79,6 +79,15 @@ public: showAudioFilters: true raiseHandActionButton: enabled: true + # If enabled, before joining microphone the client will perform a trickle + # ICE against Kurento and use the information about successfull + # candidate-pairs to filter out local candidates in SIP.js's SDP. + # Try enabling this setting in scenarios where the listenonly mode works, + # but microphone doesn't (for example, when using VPN). + # For compatibility check "Browser compatbility" section in: + # https://developer.mozilla.org/en-US/docs/Web/API/RTCDtlsTransport/iceTransport + # This is an EXPERIMENTAL setting and the default value is false + # experimentalUseKmsTrickleIceForMicrophone: false defaultSettings: application: animations: true -- GitLab