From 22b34066132f7dd39920e7f3a2f3d3eb26695374 Mon Sep 17 00:00:00 2001 From: csett86 Date: Tue, 11 May 2021 17:08:47 +0200 Subject: [PATCH] feat(agc): Add setting to disable automatic gain control (#582) In some OS/Chromium combinations the automatic gain control goes slightly crazy, but normally its fine. Thus keep the default as is, but add an option for the users to disable it if required. Closes: #564 --- app/features/conference/components/Conference.js | 7 +++++++ app/features/settings/actionTypes.js | 10 ++++++++++ app/features/settings/actions.js | 16 ++++++++++++++++ .../settings/components/SettingsDrawer.js | 6 +++++- app/features/settings/reducer.js | 9 +++++++++ app/i18n/lang/de.json | 3 ++- app/i18n/lang/en.json | 3 ++- 7 files changed, 51 insertions(+), 3 deletions(-) diff --git a/app/features/conference/components/Conference.js b/app/features/conference/components/Conference.js index 9bd6a16..bd0fc22 100644 --- a/app/features/conference/components/Conference.js +++ b/app/features/conference/components/Conference.js @@ -34,6 +34,11 @@ type Props = { */ _alwaysOnTopWindowEnabled: boolean; + /** + * Disable automatic gain control. + */ + _disableAGC: boolean; + /** * Email of user. */ @@ -211,6 +216,7 @@ class Conference extends Component { }; const configOverwrite = { + disableAGC: this.props._disableAGC, startWithAudioMuted: this.props._startWithAudioMuted, startWithVideoMuted: this.props._startWithVideoMuted }; @@ -403,6 +409,7 @@ class Conference extends Component { function _mapStateToProps(state: Object) { return { _alwaysOnTopWindowEnabled: getSetting(state, 'alwaysOnTopWindowEnabled', true), + _disableAGC: state.settings.disableAGC, _email: state.settings.email, _name: state.settings.name, _serverURL: state.settings.serverURL, diff --git a/app/features/settings/actionTypes.js b/app/features/settings/actionTypes.js index fd73c63..4fc7ac5 100644 --- a/app/features/settings/actionTypes.js +++ b/app/features/settings/actionTypes.js @@ -19,6 +19,16 @@ export const SET_ALWAYS_ON_TOP_WINDOW_ENABLED */ export const SET_AUDIO_MUTED = Symbol('SET_AUDIO_MUTED'); +/** + * The type of (redux) action that sets disable AGC. + * + * @type { + * type: SET_DISABLE_AGC, + * disableAGC: boolean + * } + */ +export const SET_DISABLE_AGC = Symbol('SET_DISABLE_AGC'); + /** * The type of (redux) action that sets the email of the user. * diff --git a/app/features/settings/actions.js b/app/features/settings/actions.js index 054c890..8b94cf7 100644 --- a/app/features/settings/actions.js +++ b/app/features/settings/actions.js @@ -3,6 +3,7 @@ import { SET_ALWAYS_ON_TOP_WINDOW_ENABLED, SET_AUDIO_MUTED, + SET_DISABLE_AGC, SET_EMAIL, SET_NAME, SET_SERVER_URL, @@ -108,6 +109,21 @@ export function setStartWithVideoMuted(startWithVideoMuted: boolean) { }; } +/** + * Set disable AGC. + * + * @param {boolean} disableAGC - Whether to disable AGC. + * @returns {{ + * type: SET_DISABLE_AGC, + * disableAGC: boolean + * }} + */ +export function setDisableAGC(disableAGC: boolean) { + return { + type: SET_DISABLE_AGC, + disableAGC + }; +} /** * Set window always on top. diff --git a/app/features/settings/components/SettingsDrawer.js b/app/features/settings/components/SettingsDrawer.js index 985123d..79ed1da 100644 --- a/app/features/settings/components/SettingsDrawer.js +++ b/app/features/settings/components/SettingsDrawer.js @@ -17,7 +17,7 @@ import { Onboarding, advenaceSettingsSteps, startOnboarding } from '../../onboar import { Form, SettingsContainer, TogglesContainer } from '../styled'; import { setEmail, setName, setWindowAlwaysOnTop, - setStartWithAudioMuted, setStartWithVideoMuted + setStartWithAudioMuted, setStartWithVideoMuted, setDisableAGC } from '../actions'; import SettingToggle from './SettingToggle'; @@ -163,6 +163,10 @@ class SettingsDrawer extends Component { settingChangeEvent = { setWindowAlwaysOnTop } settingName = 'alwaysOnTopWindowEnabled' /> + diff --git a/app/features/settings/reducer.js b/app/features/settings/reducer.js index 5f09b7c..cb9afec 100644 --- a/app/features/settings/reducer.js +++ b/app/features/settings/reducer.js @@ -3,6 +3,7 @@ import { SET_ALWAYS_ON_TOP_WINDOW_ENABLED, SET_AUDIO_MUTED, + SET_DISABLE_AGC, SET_EMAIL, SET_NAME, SET_SERVER_URL, @@ -12,6 +13,7 @@ import { type State = { alwaysOnTopWindowEnabled: boolean, + disableAGC: boolean, email: string, name: string, serverURL: ?string, @@ -24,6 +26,7 @@ const username = window.jitsiNodeAPI.osUserInfo().username; const DEFAULT_STATE = { alwaysOnTopWindowEnabled: true, + disableAGC: false, email: '', name: username, serverURL: undefined, @@ -53,6 +56,12 @@ export default (state: State = DEFAULT_STATE, action: Object) => { startWithAudioMuted: action.startWithAudioMuted }; + case SET_DISABLE_AGC: + return { + ...state, + disableAGC: action.disableAGC + }; + case SET_EMAIL: return { ...state, diff --git a/app/i18n/lang/de.json b/app/i18n/lang/de.json index 0a46e18..d53a02b 100644 --- a/app/i18n/lang/de.json +++ b/app/i18n/lang/de.json @@ -34,6 +34,7 @@ "invalidServer": "Falsche Server-Adresse", "invalidServerTimeout": "Ungültiger Wert für die Server-Wartezeit", "serverUrl": "Server-Adresse", - "serverTimeout": "Server-Wartezeit (in Sekunden)" + "serverTimeout": "Server-Wartezeit (in Sekunden)", + "disableAGC": "Automatische Mikrofonlautstärkeregelung deaktivieren" } } diff --git a/app/i18n/lang/en.json b/app/i18n/lang/en.json index df26637..b667cf3 100644 --- a/app/i18n/lang/en.json +++ b/app/i18n/lang/en.json @@ -34,6 +34,7 @@ "invalidServer": "Invalid Server URL", "invalidServerTimeout": "Invalid value for Server Timeout", "serverUrl": "Server URL", - "serverTimeout": "Server Timeout (in seconds)" + "serverTimeout": "Server Timeout (in seconds)", + "disableAGC": "Disable automatic gain control" } }