-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Put "is speaking?" threshold in remote config; lower default
- Loading branch information
1 parent
2b0c98f
commit cfa0711
Showing
6 changed files
with
39 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// Copyright 2022 Signal Messenger, LLC | ||
// SPDX-License-Identifier: AGPL-3.0-only | ||
|
||
import type * as RemoteConfig from '../RemoteConfig'; | ||
import { DEFAULT_AUDIO_LEVEL_FOR_SPEAKING } from './constants'; | ||
|
||
export function getAudioLevelForSpeaking( | ||
getValueFromRemoteConfig: typeof RemoteConfig.getValue | ||
): number { | ||
const configValue = getValueFromRemoteConfig( | ||
'desktop.calling.audioLevelForSpeaking' | ||
); | ||
if (typeof configValue !== 'string') { | ||
return DEFAULT_AUDIO_LEVEL_FOR_SPEAKING; | ||
} | ||
|
||
const result = parseFloat(configValue); | ||
const isResultValid = result > 0 && result <= 1; | ||
return isResultValid ? result : DEFAULT_AUDIO_LEVEL_FOR_SPEAKING; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters