fix(noise-suppression): remove no track warning on share audio flow (#11966)

* remove no track warning on share audio flow

* remove unused import
This commit is contained in:
Andrei Gavrilescu 2022-08-04 16:51:13 +03:00 committed by GitHub
parent 1abc6b1e4a
commit bdff92397b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 11 deletions

View File

@ -4,7 +4,7 @@ import { Dispatch } from 'redux';
// @ts-ignore
import { getLocalJitsiAudioTrack } from '../base/tracks';
// @ts-ignore
import { NOTIFICATION_TIMEOUT_TYPE, showErrorNotification, showWarningNotification } from '../notifications';
import { NOTIFICATION_TIMEOUT_TYPE, showErrorNotification } from '../notifications';
// @ts-ignore
import { NoiseSuppressionEffect } from '../stream-effects/noise-suppression/NoiseSuppressionEffect';
@ -59,16 +59,6 @@ export function setNoiseSuppressionEnabled(enabled: boolean) : any {
logger.info(`Attempting to set noise suppression enabled state: ${enabled}`);
if (!localAudio) {
logger.warn('Can not apply noise suppression without any local track active.');
dispatch(showWarningNotification({
titleKey: 'notify.noiseSuppressionFailedTitle',
descriptionKey: 'notify.noiseSuppressionNoTrackDescription'
}, NOTIFICATION_TIMEOUT_TYPE.MEDIUM));
return;
}
try {
if (enabled && !noiseSuppressionEnabled) {
if (!canEnableNoiseSuppression(state, dispatch, localAudio)) {

View File

@ -24,6 +24,15 @@ export function isNoiseSuppressionEnabled(state: IState): boolean {
* @returns {boolean}
*/
export function canEnableNoiseSuppression(state: IState, dispatch: Function, localAudio: any) : boolean {
if (!localAudio) {
dispatch(showWarningNotification({
titleKey: 'notify.noiseSuppressionFailedTitle',
descriptionKey: 'notify.noiseSuppressionNoTrackDescription'
}, NOTIFICATION_TIMEOUT_TYPE.MEDIUM));
return false;
}
const { channelCount } = localAudio.track.getSettings();
// Sharing screen audio implies an effect being applied to the local track, because currently we don't support