Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

rnnoise: simplify initialization

Saúl Ibarra Corretgé7646618e5a0f
diff --git a/package-lock.json b/package-lock.json
index 3c05f17bf2..6d207dc464 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -15793,8 +15793,8 @@
}
},
"rnnoise-wasm": {
- "version": "github:jitsi/rnnoise-wasm#db96d11f175a22ef56c7db1ba9550835b716e615",
- "from": "github:jitsi/rnnoise-wasm#db96d11f175a22ef56c7db1ba9550835b716e615"
+ "version": "github:jitsi/rnnoise-wasm#566a16885897704d6e6d67a1d5ac5d39781db2af",
+ "from": "github:jitsi/rnnoise-wasm#566a16885897704d6e6d67a1d5ac5d39781db2af"
},
"rsvp": {
"version": "4.8.5",
diff --git a/package.json b/package.json
index 0218ff38c2..dd2f944661 100644
--- a/package.json
+++ b/package.json
@@ -89,7 +89,7 @@
"react-transition-group": "2.4.0",
"redux": "4.0.4",
"redux-thunk": "2.2.0",
- "rnnoise-wasm": "github:jitsi/rnnoise-wasm.git#db96d11f175a22ef56c7db1ba9550835b716e615",
+ "rnnoise-wasm": "github:jitsi/rnnoise-wasm.git#566a16885897704d6e6d67a1d5ac5d39781db2af",
"styled-components": "3.4.9",
"util": "0.12.1",
"uuid": "3.1.0",
diff --git a/react/features/stream-effects/rnnoise/index.js b/react/features/stream-effects/rnnoise/index.js
index 33e69652c0..91b4afc79c 100644
--- a/react/features/stream-effects/rnnoise/index.js
+++ b/react/features/stream-effects/rnnoise/index.js
@@ -9,8 +9,7 @@ import RnnoiseProcessor from './RnnoiseProcessor';
export { RNNOISE_SAMPLE_LENGTH } from './RnnoiseProcessor';
export type { RnnoiseProcessor };
-let rnnoiseWasmInterface;
-let initializePromise;
+let rnnoiseModule;
/**
* Creates a new instance of RnnoiseProcessor.
@@ -18,20 +17,9 @@ let initializePromise;
* @returns {Promise<RnnoiseProcessor>}
*/
export function createRnnoiseProcessor() {
- if (!initializePromise) {
- initializePromise = new Promise((resolve, reject) => {
- rnnoiseWasmInterface = rnnoiseWasmInit({
- onRuntimeInitialized() {
- resolve();
- },
- onAbort(reason) {
- reject(reason);
- }
- });
- });
+ if (!rnnoiseModule) {
+ rnnoiseModule = rnnoiseWasmInit();
}
- return initializePromise.then(
- () => new RnnoiseProcessor(rnnoiseWasmInterface)
- );
+ return rnnoiseModule.then(mod => new RnnoiseProcessor(mod));
}
diff --git a/webpack.config.js b/webpack.config.js
index 5a8ad67b44..083af74841 100644
--- a/webpack.config.js
+++ b/webpack.config.js
@@ -250,12 +250,6 @@ module.exports = [
entry: {
'rnnoise-processor': './react/features/stream-effects/rnnoise/index.js'
},
- node: {
- // Emscripten generated glue code "rnnoise.js" expects node fs module,
- // we need to specify this parameter so webpack knows how to properly
- // interpret it when encountered.
- fs: 'empty'
- },
output: Object.assign({}, config.output, {
library: [ 'JitsiMeetJS', 'app', 'effects', 'rnnoise' ],
libraryTarget: 'window',