Skip to content

Commit

Permalink
feat(agc): Add setting to disable automatic gain control (#582)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
csett86 committed May 11, 2021
1 parent 4b41483 commit 22b3406
Show file tree
Hide file tree
Showing 7 changed files with 51 additions and 3 deletions.
7 changes: 7 additions & 0 deletions app/features/conference/components/Conference.js
Expand Up @@ -34,6 +34,11 @@ type Props = {
*/
_alwaysOnTopWindowEnabled: boolean;

/**
* Disable automatic gain control.
*/
_disableAGC: boolean;

/**
* Email of user.
*/
Expand Down Expand Up @@ -211,6 +216,7 @@ class Conference extends Component<Props, State> {
};

const configOverwrite = {
disableAGC: this.props._disableAGC,
startWithAudioMuted: this.props._startWithAudioMuted,
startWithVideoMuted: this.props._startWithVideoMuted
};
Expand Down Expand Up @@ -403,6 +409,7 @@ class Conference extends Component<Props, State> {
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,
Expand Down
10 changes: 10 additions & 0 deletions app/features/settings/actionTypes.js
Expand Up @@ -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.
*
Expand Down
16 changes: 16 additions & 0 deletions app/features/settings/actions.js
Expand Up @@ -3,6 +3,7 @@
import {
SET_ALWAYS_ON_TOP_WINDOW_ENABLED,
SET_AUDIO_MUTED,
SET_DISABLE_AGC,
SET_EMAIL,
SET_NAME,
SET_SERVER_URL,
Expand Down Expand Up @@ -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.
Expand Down
6 changes: 5 additions & 1 deletion app/features/settings/components/SettingsDrawer.js
Expand Up @@ -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';
Expand Down Expand Up @@ -163,6 +163,10 @@ class SettingsDrawer extends Component<Props, *> {
settingChangeEvent = { setWindowAlwaysOnTop }
settingName = 'alwaysOnTopWindowEnabled' />
</SpotlightTarget>
<SettingToggle
label = { t('settings.disableAGC') }
settingChangeEvent = { setDisableAGC }
settingName = 'disableAGC' />
</TogglesContainer>
</Panel>
<Onboarding section = 'settings-drawer' />
Expand Down
9 changes: 9 additions & 0 deletions app/features/settings/reducer.js
Expand Up @@ -3,6 +3,7 @@
import {
SET_ALWAYS_ON_TOP_WINDOW_ENABLED,
SET_AUDIO_MUTED,
SET_DISABLE_AGC,
SET_EMAIL,
SET_NAME,
SET_SERVER_URL,
Expand All @@ -12,6 +13,7 @@ import {

type State = {
alwaysOnTopWindowEnabled: boolean,
disableAGC: boolean,
email: string,
name: string,
serverURL: ?string,
Expand All @@ -24,6 +26,7 @@ const username = window.jitsiNodeAPI.osUserInfo().username;

const DEFAULT_STATE = {
alwaysOnTopWindowEnabled: true,
disableAGC: false,
email: '',
name: username,
serverURL: undefined,
Expand Down Expand Up @@ -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,
Expand Down
3 changes: 2 additions & 1 deletion app/i18n/lang/de.json
Expand Up @@ -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"
}
}
3 changes: 2 additions & 1 deletion app/i18n/lang/en.json
Expand Up @@ -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"
}
}

0 comments on commit 22b3406

Please sign in to comment.