From 30d0aabacaa4633dc33566717e1fe278df62eb6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sa=C3=BAl=20Ibarra=20Corretg=C3=A9?= Date: Fri, 12 Mar 2021 17:11:15 +0100 Subject: [PATCH] feat(build,rnnoise) don't use an external bundle for the effect The majority of the code is in the WASM file, the JS is just 9KB. It's so little, in fact, that the performance hint for the main bundle didn't have to be adjusted. --- Makefile | 2 -- react/features/conference/functions.web.js | 4 ++-- react/features/rnnoise/functions.js | 27 ---------------------- react/features/rnnoise/index.js | 2 -- webpack.config.js | 20 ---------------- 5 files changed, 2 insertions(+), 53 deletions(-) delete mode 100644 react/features/rnnoise/functions.js delete mode 100644 react/features/rnnoise/index.js diff --git a/Makefile b/Makefile index 7f07f4f2f..6866b249e 100644 --- a/Makefile +++ b/Makefile @@ -51,8 +51,6 @@ deploy-appbundle: $(OUTPUT_DIR)/analytics-ga.js \ $(BUILD_DIR)/analytics-ga.min.js \ $(BUILD_DIR)/analytics-ga.min.map \ - $(BUILD_DIR)/rnnoise-processor.min.js \ - $(BUILD_DIR)/rnnoise-processor.min.map \ $(BUILD_DIR)/close3.min.js \ $(BUILD_DIR)/close3.min.map \ $(DEPLOY_DIR) diff --git a/react/features/conference/functions.web.js b/react/features/conference/functions.web.js index 3544e72ae..e971ced20 100644 --- a/react/features/conference/functions.web.js +++ b/react/features/conference/functions.web.js @@ -6,7 +6,7 @@ import { toState } from '../base/redux'; import { getBackendSafePath, getJitsiMeetGlobalNS } from '../base/util'; import { getVpaasBillingId } from '../billing-counter/functions'; import { showWarningNotification } from '../notifications'; -import { createRnnoiseProcessorPromise } from '../rnnoise'; +import { createRnnoiseProcessor } from '../stream-effects/rnnoise'; export * from './functions.any'; @@ -84,7 +84,7 @@ export function getConferenceOptions(stateful) { options.applicationName = getName(); options.getWiFiStatsMethod = getWiFiStatsMethod; - options.createVADProcessor = createRnnoiseProcessorPromise; + options.createVADProcessor = createRnnoiseProcessor; options.billingId = getVpaasBillingId(state); // Disable CallStats, if requessted. diff --git a/react/features/rnnoise/functions.js b/react/features/rnnoise/functions.js deleted file mode 100644 index 9d1869602..000000000 --- a/react/features/rnnoise/functions.js +++ /dev/null @@ -1,27 +0,0 @@ -// @flow - -import { getJitsiMeetGlobalNS, loadScript } from '../base/util'; - -let loadRnnoisePromise; - -/** - * Returns promise that resolves with a RnnoiseProcessor instance. - * - * @returns {Promise} - Resolves with the blur effect instance. - */ -export function createRnnoiseProcessorPromise() { - // Subsequent calls should not attempt to load the script multiple times. - if (!loadRnnoisePromise) { - loadRnnoisePromise = loadScript('libs/rnnoise-processor.min.js'); - } - - return loadRnnoisePromise.then(() => { - const ns = getJitsiMeetGlobalNS(); - - if (ns?.effects?.rnnoise?.createRnnoiseProcessor) { - return ns.effects.rnnoise.createRnnoiseProcessor(); - } - - throw new Error('Rnnoise module binding createRnnoiseProcessor not found!'); - }); -} diff --git a/react/features/rnnoise/index.js b/react/features/rnnoise/index.js deleted file mode 100644 index 9142d34e1..000000000 --- a/react/features/rnnoise/index.js +++ /dev/null @@ -1,2 +0,0 @@ - -export * from './functions'; diff --git a/webpack.config.js b/webpack.config.js index bee467705..98e585afc 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -240,26 +240,6 @@ module.exports = [ performance: getPerformanceHints(128 * 1024) }), - // Because both virtual-background-effect and rnnoise-processor modules are loaded - // in a lazy manner using the loadScript function with a hard coded name, - // i.e.loadScript('libs/rnnoise-processor.min.js'), webpack dev server - // won't know how to properly load them using the default config filename - // and sourceMapFilename parameters which target libs without .min in dev - // mode. Thus we change these modules to have the same filename in both - // prod and dev mode. - Object.assign({}, config, { - entry: { - 'rnnoise-processor': './react/features/stream-effects/rnnoise/index.js' - }, - output: Object.assign({}, config.output, { - library: [ 'JitsiMeetJS', 'app', 'effects', 'rnnoise' ], - libraryTarget: 'window', - filename: '[name].min.js', - sourceMapFilename: '[name].min.map' - }), - performance: getPerformanceHints(30 * 1024) - }), - Object.assign({}, config, { entry: { 'external_api': './modules/API/external/index.js'