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.
This commit is contained in:
Saúl Ibarra Corretgé 2021-03-12 17:11:15 +01:00 committed by Saúl Ibarra Corretgé
parent 22b6d32174
commit 30d0aabaca
5 changed files with 2 additions and 53 deletions

View File

@ -51,8 +51,6 @@ deploy-appbundle:
$(OUTPUT_DIR)/analytics-ga.js \ $(OUTPUT_DIR)/analytics-ga.js \
$(BUILD_DIR)/analytics-ga.min.js \ $(BUILD_DIR)/analytics-ga.min.js \
$(BUILD_DIR)/analytics-ga.min.map \ $(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.js \
$(BUILD_DIR)/close3.min.map \ $(BUILD_DIR)/close3.min.map \
$(DEPLOY_DIR) $(DEPLOY_DIR)

View File

@ -6,7 +6,7 @@ import { toState } from '../base/redux';
import { getBackendSafePath, getJitsiMeetGlobalNS } from '../base/util'; import { getBackendSafePath, getJitsiMeetGlobalNS } from '../base/util';
import { getVpaasBillingId } from '../billing-counter/functions'; import { getVpaasBillingId } from '../billing-counter/functions';
import { showWarningNotification } from '../notifications'; import { showWarningNotification } from '../notifications';
import { createRnnoiseProcessorPromise } from '../rnnoise'; import { createRnnoiseProcessor } from '../stream-effects/rnnoise';
export * from './functions.any'; export * from './functions.any';
@ -84,7 +84,7 @@ export function getConferenceOptions(stateful) {
options.applicationName = getName(); options.applicationName = getName();
options.getWiFiStatsMethod = getWiFiStatsMethod; options.getWiFiStatsMethod = getWiFiStatsMethod;
options.createVADProcessor = createRnnoiseProcessorPromise; options.createVADProcessor = createRnnoiseProcessor;
options.billingId = getVpaasBillingId(state); options.billingId = getVpaasBillingId(state);
// Disable CallStats, if requessted. // Disable CallStats, if requessted.

View File

@ -1,27 +0,0 @@
// @flow
import { getJitsiMeetGlobalNS, loadScript } from '../base/util';
let loadRnnoisePromise;
/**
* Returns promise that resolves with a RnnoiseProcessor instance.
*
* @returns {Promise<RnnoiseProcessor>} - 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!');
});
}

View File

@ -1,2 +0,0 @@
export * from './functions';

View File

@ -240,26 +240,6 @@ module.exports = [
performance: getPerformanceHints(128 * 1024) 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, { Object.assign({}, config, {
entry: { entry: {
'external_api': './modules/API/external/index.js' 'external_api': './modules/API/external/index.js'