rnnoise: simplify initialization
This commit is contained in:
parent
6533071c4c
commit
7646618e5a
|
@ -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",
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
|
|
|
@ -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',
|
||||
|
|
Loading…
Reference in New Issue