-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
111 changed files
with
2,255 additions
and
595 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+3.04 KB
.yarn/cache/@babel-helper-annotate-as-pure-npm-7.10.4-61cb45f47d-535cdf631e.zip
Binary file not shown.
Binary file added
BIN
+3.47 KB
...el-helper-builder-binary-assignment-operator-visitor-npm-7.10.4-84f16304b7-369530a197.zip
Binary file not shown.
Binary file removed
BIN
-8.65 KB
.yarn/cache/@babel-helper-compilation-targets-npm-7.10.1-e6d6022efa-1e5f05e810.zip
Binary file not shown.
Binary file added
BIN
+8.67 KB
.yarn/cache/@babel-helper-compilation-targets-npm-7.12.5-fb01191ab0-5e81181e04.zip
Binary file not shown.
Binary file added
BIN
+13.8 KB
.yarn/cache/@babel-helper-create-class-features-plugin-npm-7.12.1-fc3d37998d-d686eae70d.zip
Binary file not shown.
Binary file added
BIN
+4.92 KB
.yarn/cache/@babel-helper-create-regexp-features-plugin-npm-7.12.1-ad23561fb3-bf4b72eaed.zip
Binary file not shown.
Binary file added
BIN
+3.8 KB
.yarn/cache/@babel-helper-define-map-npm-7.10.5-a39821074e-964cab640d.zip
Binary file not shown.
Binary file added
BIN
+3.44 KB
.yarn/cache/@babel-helper-explode-assignable-expression-npm-7.12.1-be0a404ab2-cb3b265727.zip
Binary file not shown.
Binary file added
BIN
+4.01 KB
.yarn/cache/@babel-helper-function-name-npm-7.10.4-153d80f559-41ab8f48bb.zip
Binary file not shown.
Binary file added
BIN
+2.95 KB
.yarn/cache/@babel-helper-get-function-arity-npm-7.10.4-29a99c32bb-4f0ddd4340.zip
Binary file not shown.
Binary file added
BIN
+3.16 KB
.yarn/cache/@babel-helper-hoist-variables-npm-7.10.4-ba6140a324-0bc1976366.zip
Binary file not shown.
Binary file added
BIN
+5.01 KB
...n/cache/@babel-helper-member-expression-to-functions-npm-7.12.1-cae2fe0eb8-ae0cd0594b.zip
Binary file not shown.
Binary file added
BIN
+6.62 KB
.yarn/cache/@babel-helper-module-imports-npm-7.12.5-76d7bcabe9-7f63b03496.zip
Binary file not shown.
Binary file added
BIN
+12 KB
.yarn/cache/@babel-helper-module-transforms-npm-7.12.1-c42d2455d3-902ed2b8e9.zip
Binary file not shown.
Binary file added
BIN
+3.12 KB
.yarn/cache/@babel-helper-optimise-call-expression-npm-7.10.4-135301e242-70dd5a6daf.zip
Binary file not shown.
Binary file added
BIN
+3.22 KB
.yarn/cache/@babel-helper-plugin-utils-npm-7.10.4-af87df4f11-9f617e619a.zip
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+3.48 KB
.yarn/cache/@babel-helper-remap-async-to-generator-npm-7.12.1-ed3338b613-8bc24e91f1.zip
Binary file not shown.
Binary file added
BIN
+4.33 KB
.yarn/cache/@babel-helper-replace-supers-npm-7.12.5-d419f2f51e-5a9ac871de.zip
Binary file not shown.
Binary file added
BIN
+3.43 KB
.yarn/cache/@babel-helper-simple-access-npm-7.12.1-18caff947e-ca44e3f694.zip
Binary file not shown.
Binary file added
BIN
+3.16 KB
...e/@babel-helper-skip-transparent-expression-wrappers-npm-7.12.1-115c18dee8-2e690ed565.zip
Binary file not shown.
Binary file added
BIN
+3.39 KB
.yarn/cache/@babel-helper-split-export-declaration-npm-7.11.0-d39c69702f-ddfc44d0cf.zip
Binary file not shown.
Binary file added
BIN
+8.97 KB
.yarn/cache/@babel-helper-validator-identifier-npm-7.10.4-0689d787fa-25098ef842.zip
Binary file not shown.
Binary file added
BIN
+3.78 KB
.yarn/cache/@babel-helper-validator-option-npm-7.12.1-617a30f6da-5d9a8f6750.zip
Binary file not shown.
Binary file added
BIN
+3.62 KB
.yarn/cache/@babel-helper-wrap-function-npm-7.12.3-ef6223c955-4731c4ec0e.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+4.59 KB
...che/@babel-plugin-proposal-async-generator-functions-npm-7.12.1-f71278c3bd-59f8c4e469.zip
Binary file not shown.
Binary file added
BIN
+2.95 KB
.yarn/cache/@babel-plugin-proposal-class-properties-npm-7.12.1-002e18ae19-690cbec3df.zip
Binary file not shown.
Binary file added
BIN
+3.17 KB
.yarn/cache/@babel-plugin-proposal-dynamic-import-npm-7.12.1-b81c2ca860-4428439b48.zip
Binary file not shown.
Binary file added
BIN
+3.29 KB
...n/cache/@babel-plugin-proposal-export-namespace-from-npm-7.12.1-5532ca81a9-ae5317ca00.zip
Binary file not shown.
Binary file added
BIN
+3.09 KB
.yarn/cache/@babel-plugin-proposal-json-strings-npm-7.12.1-92e281e511-fbe4f3241c.zip
Binary file not shown.
Binary file added
BIN
+3.41 KB
.../@babel-plugin-proposal-logical-assignment-operators-npm-7.12.1-5403a64ecb-08af656aaa.zip
Binary file not shown.
Binary file added
BIN
+3.35 KB
...e/@babel-plugin-proposal-nullish-coalescing-operator-npm-7.12.1-6c48e82bfa-9c825901a1.zip
Binary file not shown.
Binary file added
BIN
+3.01 KB
.yarn/cache/@babel-plugin-proposal-numeric-separator-npm-7.12.5-b21c3f2c81-c3c9a12a9a.zip
Binary file not shown.
Binary file added
BIN
+6.1 KB
.yarn/cache/@babel-plugin-proposal-object-rest-spread-npm-7.12.1-23ec83a49a-d14fc95dad.zip
Binary file not shown.
Binary file added
BIN
+3.03 KB
.../cache/@babel-plugin-proposal-optional-catch-binding-npm-7.12.1-c517c19ef1-ca8c20fb73.zip
Binary file not shown.
Binary file added
BIN
+4.26 KB
.yarn/cache/@babel-plugin-proposal-optional-chaining-npm-7.12.1-14658e6b1e-3cca1bf3b3.zip
Binary file not shown.
Binary file added
BIN
+2.87 KB
.yarn/cache/@babel-plugin-proposal-private-methods-npm-7.12.1-da0018e1a0-350a1a8c3d.zip
Binary file not shown.
Binary file added
BIN
+3.09 KB
.../cache/@babel-plugin-proposal-unicode-property-regex-npm-7.12.1-bc433228ec-b960b8c1af.zip
Binary file not shown.
Binary file added
BIN
+2.75 KB
.yarn/cache/@babel-plugin-syntax-class-properties-npm-7.12.1-4ba7624aa7-b5e354a0cd.zip
Binary file not shown.
Binary file added
BIN
+2.83 KB
.yarn/cache/@babel-plugin-syntax-export-namespace-from-npm-7.8.3-1747201aa9-832e007319.zip
Binary file not shown.
Binary file added
BIN
+2.95 KB
...he/@babel-plugin-syntax-logical-assignment-operators-npm-7.10.4-72ae00fdf6-5b82f71770.zip
Binary file not shown.
Binary file added
BIN
+2.88 KB
.yarn/cache/@babel-plugin-syntax-numeric-separator-npm-7.10.4-81444be605-47ae878293.zip
Binary file not shown.
Binary file added
BIN
+2.74 KB
.yarn/cache/@babel-plugin-syntax-top-level-await-npm-7.12.1-d8555be35e-9767e46ddc.zip
Binary file not shown.
Binary file added
BIN
+2.88 KB
.yarn/cache/@babel-plugin-transform-arrow-functions-npm-7.12.1-559a4078ed-602be39f30.zip
Binary file not shown.
Binary file added
BIN
+3.15 KB
.yarn/cache/@babel-plugin-transform-async-to-generator-npm-7.12.1-a5107a2a59-96a48e5cbf.zip
Binary file not shown.
Binary file added
BIN
+3.17 KB
...cache/@babel-plugin-transform-block-scoped-functions-npm-7.12.1-4ddf1c64a0-2da63c6b92.zip
Binary file not shown.
Binary file added
BIN
+8.09 KB
.yarn/cache/@babel-plugin-transform-block-scoping-npm-7.12.1-d0c7a9d5f7-067f8b55a3.zip
Binary file not shown.
Binary file added
BIN
+8.91 KB
.yarn/cache/@babel-plugin-transform-classes-npm-7.12.1-fc8ee4e566-ae895d1a20.zip
Binary file not shown.
Binary file added
BIN
+3.98 KB
.yarn/cache/@babel-plugin-transform-computed-properties-npm-7.12.1-322012d191-b3680b9c03.zip
Binary file not shown.
Binary file added
BIN
+6.04 KB
.yarn/cache/@babel-plugin-transform-destructuring-npm-7.12.1-fa3ad97f82-704057fa7c.zip
Binary file not shown.
Binary file added
BIN
+2.87 KB
.yarn/cache/@babel-plugin-transform-dotall-regex-npm-7.12.1-57f977d6c3-dd522110c9.zip
Binary file not shown.
Binary file added
BIN
+3.13 KB
.yarn/cache/@babel-plugin-transform-duplicate-keys-npm-7.12.1-2ee786bbf3-a8c45815fb.zip
Binary file not shown.
Binary file added
BIN
+3.08 KB
...ache/@babel-plugin-transform-exponentiation-operator-npm-7.12.1-271f649ee1-9a01b93506.zip
Binary file not shown.
Binary file added
BIN
+5.89 KB
.yarn/cache/@babel-plugin-transform-for-of-npm-7.12.1-93111bd158-d51761cecb.zip
Binary file not shown.
Binary file added
BIN
+2.98 KB
.yarn/cache/@babel-plugin-transform-function-name-npm-7.12.1-6ce3ca221a-7dff23e9b5.zip
Binary file not shown.
Binary file added
BIN
+2.78 KB
.yarn/cache/@babel-plugin-transform-literals-npm-7.12.1-6660b188a4-1bc7a828e0.zip
Binary file not shown.
Binary file added
BIN
+3.07 KB
...e/@babel-plugin-transform-member-expression-literals-npm-7.12.1-c5b80ce730-2a216ee882.zip
Binary file not shown.
Binary file added
BIN
+3.96 KB
.yarn/cache/@babel-plugin-transform-modules-amd-npm-7.12.1-8fe2fb8398-0b22d7ccf3.zip
Binary file not shown.
Binary file added
BIN
+4.51 KB
.yarn/cache/@babel-plugin-transform-modules-commonjs-npm-7.12.1-ccf6f4a926-7201ad5f82.zip
Binary file not shown.
Binary file added
BIN
+6.31 KB
.yarn/cache/@babel-plugin-transform-modules-systemjs-npm-7.12.1-c1130bdc6f-f47d070eda.zip
Binary file not shown.
Binary file added
BIN
+4.18 KB
.yarn/cache/@babel-plugin-transform-modules-umd-npm-7.12.1-dde38f73c4-9998266d1e.zip
Binary file not shown.
Binary file added
BIN
+3.1 KB
...@babel-plugin-transform-named-capturing-groups-regex-npm-7.12.1-a248616e23-96eb5b3587.zip
Binary file not shown.
Binary file added
BIN
+3.17 KB
.yarn/cache/@babel-plugin-transform-new-target-npm-7.12.1-4c61f9b33d-d3b9f4f0c2.zip
Binary file not shown.
Binary file added
BIN
+3.09 KB
.yarn/cache/@babel-plugin-transform-object-super-npm-7.12.1-5cfdb6a439-36cc06f539.zip
Binary file not shown.
Binary file added
BIN
+7.36 KB
.yarn/cache/@babel-plugin-transform-parameters-npm-7.12.1-1fa4e26d98-a968ef99b6.zip
Binary file not shown.
Binary file added
BIN
+2.93 KB
.yarn/cache/@babel-plugin-transform-property-literals-npm-7.12.1-e86a3c4f5d-dff34b03d8.zip
Binary file not shown.
Binary file added
BIN
+2.74 KB
.yarn/cache/@babel-plugin-transform-regenerator-npm-7.12.1-aba30ba094-a1722c2847.zip
Binary file not shown.
Binary file added
BIN
+2.83 KB
.yarn/cache/@babel-plugin-transform-reserved-words-npm-7.12.1-7930992fe4-41f589086b.zip
Binary file not shown.
Binary file added
BIN
+3.02 KB
...n/cache/@babel-plugin-transform-shorthand-properties-npm-7.12.1-e012360208-36cd37c9dd.zip
Binary file not shown.
Binary file added
BIN
+3.59 KB
.yarn/cache/@babel-plugin-transform-spread-npm-7.12.1-35eddf11b1-905e1872e3.zip
Binary file not shown.
Binary file added
BIN
+3.23 KB
.yarn/cache/@babel-plugin-transform-sticky-regex-npm-7.12.1-c9b73885f9-c7d0f39481.zip
Binary file not shown.
Binary file added
BIN
+3.75 KB
.yarn/cache/@babel-plugin-transform-template-literals-npm-7.12.1-a0bc53e621-2e37a8efa3.zip
Binary file not shown.
Binary file added
BIN
+3.47 KB
.yarn/cache/@babel-plugin-transform-typeof-symbol-npm-7.12.1-66419b0948-73bb34cb44.zip
Binary file not shown.
Binary file added
BIN
+3.67 KB
.yarn/cache/@babel-plugin-transform-unicode-escapes-npm-7.12.1-bacb2035a1-40f57b173a.zip
Binary file not shown.
Binary file added
BIN
+2.8 KB
.yarn/cache/@babel-plugin-transform-unicode-regex-npm-7.12.1-99d75a41c7-411ddc96ef.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed
BIN
-18.6 KB
.yarn/cache/@rollup-plugin-babel-npm-5.0.2-a8cb6ac5e9-29aeff8891.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+10.6 KB
.yarn/cache/electron-to-chromium-npm-1.3.589-91b0cce61a-71257f9500.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
import { promises as fs } from "fs"; | ||
import { resolve } from "path"; | ||
import { createEncoder, WasmMediaEncoder } from "../encoder"; | ||
|
||
describe.each([ | ||
["audio/mpeg" as const, "mp3.wasm"], | ||
["audio/ogg" as const, "ogg.wasm"], | ||
])("MIME %s", (mimeType, filename) => { | ||
let wasm: Buffer; | ||
beforeAll(async () => { | ||
wasm = await fs.readFile(resolve(__dirname, "../wasm/build", filename)); | ||
}); | ||
|
||
test("Unsupported mimeType", async () => { | ||
await expect( | ||
createEncoder("video/mpeg" as any, undefined as any) | ||
).rejects.toBeInstanceOf(Error); | ||
}); | ||
|
||
test("fetch from custom url", async () => { | ||
await expect( | ||
createEncoder(mimeType, `https://example.com/${filename}`) | ||
).rejects.toBeInstanceOf(Error); | ||
}); | ||
|
||
test("fetch from data uri", async () => { | ||
const dataUri = "data:application/wasm;base64," + wasm.toString("base64"); | ||
|
||
await expect(createEncoder(mimeType, dataUri)).resolves.toBeInstanceOf( | ||
WasmMediaEncoder | ||
); | ||
}); | ||
|
||
test("use buffer", async () => { | ||
await expect(createEncoder(mimeType, wasm)).resolves.toBeInstanceOf( | ||
WasmMediaEncoder | ||
); | ||
}); | ||
|
||
test("use precompiled module", async () => { | ||
const mockCallback = jest.fn(); | ||
const module = await WebAssembly.compile(wasm); | ||
await expect( | ||
createEncoder(mimeType, await WebAssembly.compile(wasm), mockCallback) | ||
).resolves.toBeInstanceOf(WasmMediaEncoder); | ||
expect(mockCallback).toHaveBeenCalledWith(module); | ||
}); | ||
|
||
test("compiled module callback", async () => { | ||
const mockCallback = jest.fn(); | ||
await expect( | ||
createEncoder(mimeType, wasm, mockCallback) | ||
).resolves.toBeInstanceOf(WasmMediaEncoder); | ||
expect(mockCallback).toHaveBeenCalledTimes(1); | ||
expect(mockCallback.mock.calls[0][0]).toBeInstanceOf(WebAssembly.Module); | ||
}); | ||
|
||
test("Buffer reallocation", async () => { | ||
const encoder = await createEncoder(mimeType, wasm); | ||
expect(encoder).toBeInstanceOf(WasmMediaEncoder); | ||
encoder.configure({ sampleRate: 48000, channels: 1 }); | ||
|
||
// Emscripten initial memory size is 256 pages (64KiB each) | ||
expect(encoder.encode([new Float32Array(16 * 1024 * 256)])).toBeInstanceOf( | ||
Uint8Array | ||
); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.