-
Notifications
You must be signed in to change notification settings - Fork 477
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Save the redundant audio worker code during build time so that the wo…
…rker code stays intact and is able to be loaded The redundant audio worker code string may vary based on the build system of different projects. Because of this, certain build systems will cause invalid worker code to be generated and the redundant audio worker will not be able to run. Now, the redundant audio worker code is saved at build time so that all clients can run the redundant audio worker with the same exact code, regardless of the client's build system. This issue was originally found in #2771.
- Loading branch information
1 parent
12418f3
commit 3cb7500
Showing
16 changed files
with
1,510 additions
and
1,213 deletions.
There are no files selected for viewing
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,10 @@ | ||
{ | ||
"extends": "./tsconfig.base.json", | ||
"compilerOptions": { | ||
"outDir": "../build", | ||
"rootDir": "../src" | ||
}, | ||
"include": [ | ||
"../src/redundantaudioencoder/RedundantAudioEncoder.ts", | ||
] | ||
} |
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
56 changes: 28 additions & 28 deletions
56
docs/classes/simulcastcontentsharetransceivercontroller.html
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
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,35 @@ | ||
#!/usr/bin/env node | ||
|
||
/** | ||
* This script takes the transpiled JavaScript code for `RedundantAudioEncoder` and places all of that code into a | ||
* string that can be used to run a worker. | ||
*/ | ||
|
||
const fs = require('fs'); | ||
const RedundantAudioEncoder = require('../build/redundantaudioencoder/RedundantAudioEncoder.js').default; | ||
|
||
const debugLine = 'RedundantAudioEncoder.shouldLogDebug = true;'; | ||
const withDebug = `${RedundantAudioEncoder.toString().replace(/"/g, '\'').replace(/\n/g, "\\n")}\\n${debugLine}\\nRedundantAudioEncoder.shouldReportStats = true;\\nRedundantAudioEncoder.initializeWorker();` | ||
|
||
const workerFileContent = `// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
/** | ||
* This file was generated with the \`generate-red-worker-code.js\` script. | ||
*/ | ||
export default class RedundantAudioEncoderWorkerCode { | ||
static readonly withDebug = | ||
"${withDebug}"; | ||
static readonly withoutDebug = RedundantAudioEncoderWorkerCode.withDebug.replace( | ||
'${debugLine}', | ||
'' | ||
); | ||
} | ||
`; | ||
|
||
const redDir = './src/redundantaudioencoder'; | ||
if (!fs.existsSync(redDir)) fs.mkdirSync(redDir, { recursive: true }); | ||
|
||
const workerFile = 'RedundantAudioEncoderWorkerCode.ts'; | ||
fs.writeFileSync(`${redDir}/${workerFile}`, workerFileContent); |
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
15 changes: 15 additions & 0 deletions
15
src/redundantaudioencoder/RedundantAudioEncoderWorkerCode.ts
Large diffs are not rendered by default.
Oops, something went wrong.
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