Pārlūkot izejas kodu

rnnoise: simplify initialization

master
Saúl Ibarra Corretgé 4 gadus atpakaļ
vecāks
revīzija
7646618e5a

+ 2
- 2
package-lock.json Parādīt failu

@@ -15793,8 +15793,8 @@
15793 15793
       }
15794 15794
     },
15795 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 15799
     "rsvp": {
15800 15800
       "version": "4.8.5",

+ 1
- 1
package.json Parādīt failu

@@ -89,7 +89,7 @@
89 89
     "react-transition-group": "2.4.0",
90 90
     "redux": "4.0.4",
91 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 93
     "styled-components": "3.4.9",
94 94
     "util": "0.12.1",
95 95
     "uuid": "3.1.0",

+ 4
- 16
react/features/stream-effects/rnnoise/index.js Parādīt failu

@@ -9,8 +9,7 @@ import RnnoiseProcessor from './RnnoiseProcessor';
9 9
 export { RNNOISE_SAMPLE_LENGTH } from './RnnoiseProcessor';
10 10
 export type { RnnoiseProcessor };
11 11
 
12
-let rnnoiseWasmInterface;
13
-let initializePromise;
12
+let rnnoiseModule;
14 13
 
15 14
 /**
16 15
  * Creates a new instance of RnnoiseProcessor.
@@ -18,20 +17,9 @@ let initializePromise;
18 17
  * @returns {Promise<RnnoiseProcessor>}
19 18
  */
20 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 Parādīt failu

@@ -250,12 +250,6 @@ module.exports = [
250 250
         entry: {
251 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 253
         output: Object.assign({}, config.output, {
260 254
             library: [ 'JitsiMeetJS', 'app', 'effects', 'rnnoise' ],
261 255
             libraryTarget: 'window',

Notiek ielāde…
Atcelt
Saglabāt