Browse Source

rnnoise: simplify initialization

master
Saúl Ibarra Corretgé 5 years ago
parent
commit
7646618e5a
4 changed files with 7 additions and 25 deletions
  1. 2
    2
      package-lock.json
  2. 1
    1
      package.json
  3. 4
    16
      react/features/stream-effects/rnnoise/index.js
  4. 0
    6
      webpack.config.js

+ 2
- 2
package-lock.json View File

15793
       }
15793
       }
15794
     },
15794
     },
15795
     "rnnoise-wasm": {
15795
     "rnnoise-wasm": {
15796
-      "version": "github:jitsi/rnnoise-wasm#db96d11f175a22ef56c7db1ba9550835b716e615",
15797
-      "from": "github:jitsi/rnnoise-wasm#db96d11f175a22ef56c7db1ba9550835b716e615"
15796
+      "version": "github:jitsi/rnnoise-wasm#566a16885897704d6e6d67a1d5ac5d39781db2af",
15797
+      "from": "github:jitsi/rnnoise-wasm#566a16885897704d6e6d67a1d5ac5d39781db2af"
15798
     },
15798
     },
15799
     "rsvp": {
15799
     "rsvp": {
15800
       "version": "4.8.5",
15800
       "version": "4.8.5",

+ 1
- 1
package.json View File

89
     "react-transition-group": "2.4.0",
89
     "react-transition-group": "2.4.0",
90
     "redux": "4.0.4",
90
     "redux": "4.0.4",
91
     "redux-thunk": "2.2.0",
91
     "redux-thunk": "2.2.0",
92
-    "rnnoise-wasm": "github:jitsi/rnnoise-wasm.git#db96d11f175a22ef56c7db1ba9550835b716e615",
92
+    "rnnoise-wasm": "github:jitsi/rnnoise-wasm.git#566a16885897704d6e6d67a1d5ac5d39781db2af",
93
     "styled-components": "3.4.9",
93
     "styled-components": "3.4.9",
94
     "util": "0.12.1",
94
     "util": "0.12.1",
95
     "uuid": "3.1.0",
95
     "uuid": "3.1.0",

+ 4
- 16
react/features/stream-effects/rnnoise/index.js View File

9
 export { RNNOISE_SAMPLE_LENGTH } from './RnnoiseProcessor';
9
 export { RNNOISE_SAMPLE_LENGTH } from './RnnoiseProcessor';
10
 export type { RnnoiseProcessor };
10
 export type { RnnoiseProcessor };
11
 
11
 
12
-let rnnoiseWasmInterface;
13
-let initializePromise;
12
+let rnnoiseModule;
14
 
13
 
15
 /**
14
 /**
16
  * Creates a new instance of RnnoiseProcessor.
15
  * Creates a new instance of RnnoiseProcessor.
18
  * @returns {Promise<RnnoiseProcessor>}
17
  * @returns {Promise<RnnoiseProcessor>}
19
  */
18
  */
20
 export function createRnnoiseProcessor() {
19
 export function createRnnoiseProcessor() {
21
-    if (!initializePromise) {
22
-        initializePromise = new Promise((resolve, reject) => {
23
-            rnnoiseWasmInterface = rnnoiseWasmInit({
24
-                onRuntimeInitialized() {
25
-                    resolve();
26
-                },
27
-                onAbort(reason) {
28
-                    reject(reason);
29
-                }
30
-            });
31
-        });
20
+    if (!rnnoiseModule) {
21
+        rnnoiseModule = rnnoiseWasmInit();
32
     }
22
     }
33
 
23
 
34
-    return initializePromise.then(
35
-        () => new RnnoiseProcessor(rnnoiseWasmInterface)
36
-    );
24
+    return rnnoiseModule.then(mod => new RnnoiseProcessor(mod));
37
 }
25
 }

+ 0
- 6
webpack.config.js View File

250
         entry: {
250
         entry: {
251
             'rnnoise-processor': './react/features/stream-effects/rnnoise/index.js'
251
             'rnnoise-processor': './react/features/stream-effects/rnnoise/index.js'
252
         },
252
         },
253
-        node: {
254
-            // Emscripten generated glue code "rnnoise.js" expects node fs module,
255
-            // we need to specify this parameter so webpack knows how to properly
256
-            // interpret it when encountered.
257
-            fs: 'empty'
258
-        },
259
         output: Object.assign({}, config.output, {
253
         output: Object.assign({}, config.output, {
260
             library: [ 'JitsiMeetJS', 'app', 'effects', 'rnnoise' ],
254
             library: [ 'JitsiMeetJS', 'app', 'effects', 'rnnoise' ],
261
             libraryTarget: 'window',
255
             libraryTarget: 'window',

Loading…
Cancel
Save