@vpalmisano/webrtcperf 4.1.10 → 4.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +685 -235
- package/app.min.js +1 -1
- package/build/src/app.js +3 -1
- package/build/src/app.js.map +1 -1
- package/build/src/config.d.ts +91 -1
- package/build/src/config.js +114 -10
- package/build/src/config.js.map +1 -1
- package/build/src/server.d.ts +1 -1
- package/build/src/server.js +4 -4
- package/build/src/server.js.map +1 -1
- package/build/src/stats.d.ts +3 -3
- package/build/src/stats.js +8 -8
- package/build/src/stats.js.map +1 -1
- package/build/tsconfig.tsbuildinfo +1 -1
- package/package.json +24 -24
- package/src/app.ts +5 -2
- package/src/config.ts +117 -11
- package/src/server.ts +4 -4
- package/src/stats.ts +9 -9
package/build/src/app.js
CHANGED
|
@@ -160,7 +160,9 @@ async function setupApplication(config) {
|
|
|
160
160
|
*/
|
|
161
161
|
async function main() {
|
|
162
162
|
showHelpOrVersion();
|
|
163
|
-
const config =
|
|
163
|
+
const config = process.argv[2] === '--prompt'
|
|
164
|
+
? await (0, config_1.loadConfigFromPrompt)(process.argv.slice(3).join(' '))
|
|
165
|
+
: await (0, config_1.loadConfig)(process.argv[2]);
|
|
164
166
|
if (config.vmafPrepareVideo) {
|
|
165
167
|
await (0, vmaf_1.prepareVideo)(config, true);
|
|
166
168
|
process.exit(0);
|
package/build/src/app.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app.js","sourceRoot":"","sources":["../../src/app.ts"],"names":[],"mappings":";;;;;AAqEA,4CAkHC;AAvLD,qDAA4F;AAC5F,6CAAuC;AACvC,4CAAmB;AACnB,kDAAyB;AACzB,0DAA4B;AAE5B,qCAA4D;AAC5D,mCAAqD;AACrD,qCAAiC;AACjC,uCAAmC;AACnC,mCAA+B;AAC/B,mCAUgB;AAChB,qCAA+C;AAC/C,iCAAuE;AACvE,gDAAuB;AAEvB,MAAM,GAAG,GAA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AG,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC;gBAClC,IAAI,CAAC;oBACH,MAAM,IAAI,EAAE,CAAA;gBACd,CAAC;gBAAC,OAAO,GAAY,EAAE,CAAC;oBACtB,GAAG,CAAC,KAAK,CAAC,eAAgB,GAAa,CAAC,KAAK,EAAE,CAAC,CAAA;oBAChD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;gBACjB,CAAC;YACH,CAAC;iBAAM,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC;gBACzC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;YACjB,CAAC;QACH,CAAC,CAAC,CAAA;IACJ,CAAC;AACH,CAAC;AAED,IAAI,OAAO,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;IAC5B,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE;QACjB,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;QAClB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAA;IAClB,CAAC,CAAC,CAAA;AACJ,CAAC","sourcesContent":["import { getSessionThrottleIndex, startThrottle, stopThrottle } from '@vpalmisano/throttler'\nimport { paramCase } from 'change-case'\nimport fs from 'fs'\nimport json5 from 'json5'\nimport wrap from 'word-wrap'\n\nimport { Config, getConfigDocs, loadConfig } from './config'\nimport { MediaPath, prepareFakeMedia } from './media'\nimport { Server } from './server'\nimport { Session } from './session'\nimport { Stats } from './stats'\nimport {\n checkChromeExecutable,\n getDockerLogsPath,\n logger,\n registerExitHandler,\n resolvePackagePath,\n sleep,\n startRandomActivateAudio,\n stopRandomActivateAudio,\n stopTimers,\n} from './utils'\nimport { calculateVisqolScore } from './visqol'\nimport { calculateVmafScore, convertToIvf, prepareVideo } from './vmaf'\nimport path from 'path'\n\nconst log = logger('webrtcperf')\n\nfunction showHelpOrVersion(): void {\n if (process.argv.findIndex(a => a.localeCompare('--help') === 0) !== -1) {\n const docs = getConfigDocs()\n let out = `Params:\\n --version\\n It shows the package version.\\n`\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n Object.entries(docs).forEach(([name, value]: [string, any]) => {\n out += ` --${paramCase(name)}\n${wrap(value.doc, { width: 72, indent: ' ' })}\n Default: ${value.default}\\n`\n })\n console.log(out)\n process.exit(0)\n } else if (process.argv.findIndex(a => a.localeCompare('--version') === 0) !== -1) {\n const version = json5.parse(fs.readFileSync(resolvePackagePath('package.json')).toString()).version\n console.log(version)\n process.exit(0)\n }\n}\n\nasync function postTest(config: Config): Promise<void> {\n // vmaf score.\n if (config.vmafPath) {\n console.log('Calculating VMAF score...')\n try {\n await calculateVmafScore(config)\n } catch (err: unknown) {\n log.error(`vmaf score error: ${(err as Error).stack}`)\n }\n }\n\n // visqol score\n if (config.visqolPath) {\n console.log('Calculating Visqol score...')\n try {\n await calculateVisqolScore(config)\n } catch (err: unknown) {\n log.error(`visqol score error: ${(err as Error).stack}`)\n }\n }\n}\n\nexport async function setupApplication(config: Config): Promise<{ stats: Stats; stop: () => Promise<void> }> {\n if (!config.startTimestamp) {\n config.startTimestamp = Date.now()\n }\n\n // Stats.\n const stats = new Stats(config)\n await stats.start()\n\n // Control server.\n let server: Server | undefined\n if (config.serverPort) {\n server = new Server(config, stats)\n await server.start()\n }\n\n // If sessions are set, prepare fake video/audio and start sessions.\n if (config.sessions > 0) {\n // Prepare fake video and audio.\n const mediaPaths: MediaPath[] = []\n if (config.videoPath) {\n for (const videoPath of config.videoPath.split(',')) {\n const ret = await prepareFakeMedia({ ...config, videoPath })\n mediaPaths.push(ret)\n }\n }\n\n // Network throttle.\n if (config.throttleConfig) {\n await startThrottle(config.throttleConfig)\n }\n\n // Download browser if necessary.\n if (!config.chromiumUrl && !config.chromiumPath) {\n await checkChromeExecutable()\n }\n\n // Start session function.\n const startLocalSession = async (id: number, spawnPeriod: number): Promise<void> => {\n const throttleIndex = getSessionThrottleIndex(id)\n const mediaPath = mediaPaths.length ? mediaPaths[id % mediaPaths.length] : undefined\n const session = new Session({\n ...config,\n mediaPath,\n spawnPeriod,\n id,\n throttleIndex,\n })\n session.once('stop', () => {\n console.warn(`Session ${id} stopped, reloading...`)\n setTimeout(startLocalSession, spawnPeriod, id)\n })\n stats.addSession(session)\n await session.start()\n }\n\n // Start the local sessions.\n if (config.randomAudioPeriod) {\n startRandomActivateAudio(\n stats.sessions,\n config.randomAudioPeriod,\n config.randomAudioProbability,\n config.randomAudioRange,\n )\n }\n const spawnPeriod = 1000 / config.spawnRate\n log.debug(`Starting ${config.sessions} sessions (spawnPeriod: ${spawnPeriod}ms)`)\n const startTime = Date.now()\n for (let i = 0; i < config.sessions; i += 1) {\n const id = stats.consumeSessionId(config.tabsPerSession)\n await startLocalSession(id, spawnPeriod)\n // If not the last session, sleep\n if (i < config.sessions - 1) {\n await sleep(spawnPeriod)\n }\n }\n const elapsed = Math.round((Date.now() - startTime) / 1000)\n const spawnRate = (config.sessions * config.tabsPerSession) / elapsed\n log.debug(`${config.sessions * config.tabsPerSession} pages started in ${elapsed}s (${spawnRate.toFixed(2)}/s)`)\n }\n\n return {\n stats,\n stop: async (): Promise<void> => {\n log.debug('Stopping')\n\n stopRandomActivateAudio()\n\n await stats.stop()\n\n if (config.throttleConfig) {\n await stopThrottle()\n }\n\n stopTimers()\n\n await postTest(config)\n\n // Copy docker logs to data directory.\n if (config.pageLogPath) {\n try {\n const logPath = await getDockerLogsPath()\n const dataDir = path.dirname(config.pageLogPath)\n await fs.promises.cp(logPath, path.resolve(dataDir, 'docker.log'))\n } catch (err: unknown) {\n log.debug(`docker logs not found: ${(err as Error).message}`)\n }\n }\n\n server?.stop()\n\n log.debug('Stopped')\n },\n }\n}\n\n/**\n * Main function\n */\nasync function main(): Promise<void> {\n showHelpOrVersion()\n\n const config = await loadConfig(process.argv[2])\n\n if (config.vmafPrepareVideo) {\n await prepareVideo(config, true)\n process.exit(0)\n }\n\n if (config.vmafProcessVideo) {\n await convertToIvf(\n config.vmafProcessVideo,\n config.vmafVideoCrop,\n config.vmafKeepSourceFiles,\n config.vmafSkipDuplicated,\n )\n process.exit(0)\n }\n\n const { stop: stopApplication } = await setupApplication(config)\n\n const stop = async (): Promise<void> => {\n console.log('Exiting...')\n\n await stopApplication()\n\n process.exit(0)\n }\n registerExitHandler(() => stop())\n\n // Stop after a configured duration.\n setTimeout(stop, config.runDuration * 1000)\n\n // Command line interface.\n if (process.stdin && process.stdin.setRawMode) {\n console.log('Press [q] to quit or [x] to exit immediately')\n process.stdin.setRawMode(true)\n process.stdin.resume()\n process.stdin.on('data', async data => {\n log.debug('[stdin]', data[0])\n if (data[0] === 'q'.charCodeAt(0)) {\n try {\n await stop()\n } catch (err: unknown) {\n log.error(`stop error: ${(err as Error).stack}`)\n process.exit(1)\n }\n } else if (data[0] === 'x'.charCodeAt(0)) {\n process.exit(1)\n }\n })\n }\n}\n\nif (require.main === module) {\n main().catch(err => {\n console.error(err)\n process.exit(-1)\n })\n}\n"]}
|
|
1
|
+
{"version":3,"file":"app.js","sourceRoot":"","sources":["../../src/app.ts"],"names":[],"mappings":";;;;;AAqEA,4CAkHC;AAvLD,qDAA4F;AAC5F,6CAAuC;AACvC,4CAAmB;AACnB,kDAAyB;AACzB,0DAA4B;AAE5B,qCAAkF;AAClF,mCAAqD;AACrD,qCAAiC;AACjC,uCAAmC;AACnC,mCAA+B;AAC/B,mCAUgB;AAChB,qCAA+C;AAC/C,iCAAuE;AACvE,gDAAuB;AAEvB,MAAM,GAAG,GAAG,IAAA,cAAM,EAAC,YAAY,CAAC,CAAA;AAEhC,SAAS,iBAAiB;IACxB,IAAI,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,aAAa,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC;QACxE,MAAM,IAAI,GAAG,IAAA,sBAAa,GAAE,CAAA;QAC5B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IAAI,EAAE,CAAA;gBACd,CAAC;gBAAC,OAAO,GAAY,EAAE,CAAC;oBACtB,GAAG,CAAC,KAAK,CAAC,eAAgB,GAAa,CAAC,KAAK,EAAE,CAAC,CAAA;oBAChD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;gBACjB,CAAC;YACH,CAAC;iBAAM,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC;gBACzC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;YACjB,CAAC;QACH,CAAC,CAAC,CAAA;IACJ,CAAC;AACH,CAAC;AAED,IAAI,OAAO,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;IAC5B,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE;QACjB,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;QAClB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAA;IAClB,CAAC,CAAC,CAAA;AACJ,CAAC","sourcesContent":["import { getSessionThrottleIndex, startThrottle, stopThrottle } from '@vpalmisano/throttler'\nimport { paramCase } from 'change-case'\nimport fs from 'fs'\nimport json5 from 'json5'\nimport wrap from 'word-wrap'\n\nimport { Config, getConfigDocs, loadConfig, loadConfigFromPrompt } from './config'\nimport { MediaPath, prepareFakeMedia } from './media'\nimport { Server } from './server'\nimport { Session } from './session'\nimport { Stats } from './stats'\nimport {\n checkChromeExecutable,\n getDockerLogsPath,\n logger,\n registerExitHandler,\n resolvePackagePath,\n sleep,\n startRandomActivateAudio,\n stopRandomActivateAudio,\n stopTimers,\n} from './utils'\nimport { calculateVisqolScore } from './visqol'\nimport { calculateVmafScore, convertToIvf, prepareVideo } from './vmaf'\nimport path from 'path'\n\nconst log = logger('webrtcperf')\n\nfunction showHelpOrVersion(): void {\n if (process.argv.findIndex(a => a.localeCompare('--help') === 0) !== -1) {\n const docs = getConfigDocs()\n let out = `Params:\\n --version\\n It shows the package version.\\n`\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n Object.entries(docs).forEach(([name, value]: [string, any]) => {\n out += ` --${paramCase(name)}\n${wrap(value.doc, { width: 72, indent: ' ' })}\n Default: ${value.default}\\n`\n })\n console.log(out)\n process.exit(0)\n } else if (process.argv.findIndex(a => a.localeCompare('--version') === 0) !== -1) {\n const version = json5.parse(fs.readFileSync(resolvePackagePath('package.json')).toString()).version\n console.log(version)\n process.exit(0)\n }\n}\n\nasync function postTest(config: Config): Promise<void> {\n // vmaf score.\n if (config.vmafPath) {\n console.log('Calculating VMAF score...')\n try {\n await calculateVmafScore(config)\n } catch (err: unknown) {\n log.error(`vmaf score error: ${(err as Error).stack}`)\n }\n }\n\n // visqol score\n if (config.visqolPath) {\n console.log('Calculating Visqol score...')\n try {\n await calculateVisqolScore(config)\n } catch (err: unknown) {\n log.error(`visqol score error: ${(err as Error).stack}`)\n }\n }\n}\n\nexport async function setupApplication(config: Config): Promise<{ stats: Stats; stop: () => Promise<void> }> {\n if (!config.startTimestamp) {\n config.startTimestamp = Date.now()\n }\n\n // Stats.\n const stats = new Stats(config)\n await stats.start()\n\n // Control server.\n let server: Server | undefined\n if (config.serverPort) {\n server = new Server(config, stats)\n await server.start()\n }\n\n // If sessions are set, prepare fake video/audio and start sessions.\n if (config.sessions > 0) {\n // Prepare fake video and audio.\n const mediaPaths: MediaPath[] = []\n if (config.videoPath) {\n for (const videoPath of config.videoPath.split(',')) {\n const ret = await prepareFakeMedia({ ...config, videoPath })\n mediaPaths.push(ret)\n }\n }\n\n // Network throttle.\n if (config.throttleConfig) {\n await startThrottle(config.throttleConfig)\n }\n\n // Download browser if necessary.\n if (!config.chromiumUrl && !config.chromiumPath) {\n await checkChromeExecutable()\n }\n\n // Start session function.\n const startLocalSession = async (id: number, spawnPeriod: number): Promise<void> => {\n const throttleIndex = getSessionThrottleIndex(id)\n const mediaPath = mediaPaths.length ? mediaPaths[id % mediaPaths.length] : undefined\n const session = new Session({\n ...config,\n mediaPath,\n spawnPeriod,\n id,\n throttleIndex,\n })\n session.once('stop', () => {\n console.warn(`Session ${id} stopped, reloading...`)\n setTimeout(startLocalSession, spawnPeriod, id)\n })\n stats.addSession(session)\n await session.start()\n }\n\n // Start the local sessions.\n if (config.randomAudioPeriod) {\n startRandomActivateAudio(\n stats.sessions,\n config.randomAudioPeriod,\n config.randomAudioProbability,\n config.randomAudioRange,\n )\n }\n const spawnPeriod = 1000 / config.spawnRate\n log.debug(`Starting ${config.sessions} sessions (spawnPeriod: ${spawnPeriod}ms)`)\n const startTime = Date.now()\n for (let i = 0; i < config.sessions; i += 1) {\n const id = stats.consumeSessionId(config.tabsPerSession)\n await startLocalSession(id, spawnPeriod)\n // If not the last session, sleep\n if (i < config.sessions - 1) {\n await sleep(spawnPeriod)\n }\n }\n const elapsed = Math.round((Date.now() - startTime) / 1000)\n const spawnRate = (config.sessions * config.tabsPerSession) / elapsed\n log.debug(`${config.sessions * config.tabsPerSession} pages started in ${elapsed}s (${spawnRate.toFixed(2)}/s)`)\n }\n\n return {\n stats,\n stop: async (): Promise<void> => {\n log.debug('Stopping')\n\n stopRandomActivateAudio()\n\n await stats.stop()\n\n if (config.throttleConfig) {\n await stopThrottle()\n }\n\n stopTimers()\n\n await postTest(config)\n\n // Copy docker logs to data directory.\n if (config.pageLogPath) {\n try {\n const logPath = await getDockerLogsPath()\n const dataDir = path.dirname(config.pageLogPath)\n await fs.promises.cp(logPath, path.resolve(dataDir, 'docker.log'))\n } catch (err: unknown) {\n log.debug(`docker logs not found: ${(err as Error).message}`)\n }\n }\n\n server?.stop()\n\n log.debug('Stopped')\n },\n }\n}\n\n/**\n * Main function\n */\nasync function main(): Promise<void> {\n showHelpOrVersion()\n\n const config =\n process.argv[2] === '--prompt'\n ? await loadConfigFromPrompt(process.argv.slice(3).join(' '))\n : await loadConfig(process.argv[2])\n\n if (config.vmafPrepareVideo) {\n await prepareVideo(config, true)\n process.exit(0)\n }\n\n if (config.vmafProcessVideo) {\n await convertToIvf(\n config.vmafProcessVideo,\n config.vmafVideoCrop,\n config.vmafKeepSourceFiles,\n config.vmafSkipDuplicated,\n )\n process.exit(0)\n }\n\n const { stop: stopApplication } = await setupApplication(config)\n\n const stop = async (): Promise<void> => {\n console.log('Exiting...')\n\n await stopApplication()\n\n process.exit(0)\n }\n registerExitHandler(() => stop())\n\n // Stop after a configured duration.\n setTimeout(stop, config.runDuration * 1000)\n\n // Command line interface.\n if (process.stdin && process.stdin.setRawMode) {\n console.log('Press [q] to quit or [x] to exit immediately')\n process.stdin.setRawMode(true)\n process.stdin.resume()\n process.stdin.on('data', async data => {\n log.debug('[stdin]', data[0])\n if (data[0] === 'q'.charCodeAt(0)) {\n try {\n await stop()\n } catch (err: unknown) {\n log.error(`stop error: ${(err as Error).stack}`)\n process.exit(1)\n }\n } else if (data[0] === 'x'.charCodeAt(0)) {\n process.exit(1)\n }\n })\n }\n}\n\nif (require.main === module) {\n main().catch(err => {\n console.error(err)\n process.exit(-1)\n })\n}\n"]}
|
package/build/src/config.d.ts
CHANGED
|
@@ -77,7 +77,7 @@ declare const _schemaProperties: {
|
|
|
77
77
|
prometheusPushgatewayAuth: string;
|
|
78
78
|
prometheusPushgatewayGzip: boolean;
|
|
79
79
|
alertRules: string;
|
|
80
|
-
|
|
80
|
+
alertRulesOutput: string;
|
|
81
81
|
alertRulesFailPercentile: number;
|
|
82
82
|
pushStatsUrl: string;
|
|
83
83
|
pushStatsId: string;
|
|
@@ -103,4 +103,94 @@ export type Config = typeof _schemaProperties;
|
|
|
103
103
|
* Loads the config object.
|
|
104
104
|
*/
|
|
105
105
|
export declare function loadConfig(filePath?: string, values?: any): Promise<Config>;
|
|
106
|
+
export declare function loadConfigFromPrompt(prompt: string): Promise<{
|
|
107
|
+
url: string;
|
|
108
|
+
urlQuery: string;
|
|
109
|
+
customUrlHandler: string;
|
|
110
|
+
videoPath: string;
|
|
111
|
+
videoWidth: number;
|
|
112
|
+
videoHeight: number;
|
|
113
|
+
videoFramerate: number;
|
|
114
|
+
videoSeek: number;
|
|
115
|
+
videoDuration: number;
|
|
116
|
+
videoCacheRaw: boolean;
|
|
117
|
+
videoCachePath: string;
|
|
118
|
+
videoFormat: string;
|
|
119
|
+
useFakeMedia: boolean;
|
|
120
|
+
runDuration: number;
|
|
121
|
+
throttleConfig: string;
|
|
122
|
+
randomAudioPeriod: number;
|
|
123
|
+
randomAudioProbability: number;
|
|
124
|
+
randomAudioRange: string;
|
|
125
|
+
chromiumPath: string;
|
|
126
|
+
chromiumVersion: any;
|
|
127
|
+
chromiumUrl: string;
|
|
128
|
+
chromiumFieldTrials: string;
|
|
129
|
+
windowWidth: number;
|
|
130
|
+
windowHeight: number;
|
|
131
|
+
deviceScaleFactor: number;
|
|
132
|
+
maxVideoDecoders: number;
|
|
133
|
+
maxVideoDecodersRange: string;
|
|
134
|
+
incognito: boolean;
|
|
135
|
+
display: string;
|
|
136
|
+
sessions: number;
|
|
137
|
+
tabsPerSession: number;
|
|
138
|
+
startSessionId: number;
|
|
139
|
+
startTimestamp: number;
|
|
140
|
+
enableDetailedStats: string;
|
|
141
|
+
spawnRate: number;
|
|
142
|
+
showPageLog: boolean;
|
|
143
|
+
pageLogFilter: string;
|
|
144
|
+
pageLogPath: string;
|
|
145
|
+
enableBrowserLogging: string;
|
|
146
|
+
userAgent: string;
|
|
147
|
+
scriptPath: string;
|
|
148
|
+
scriptParams: string;
|
|
149
|
+
disabledVideoCodecs: string;
|
|
150
|
+
localStorage: string;
|
|
151
|
+
sessionStorage: string;
|
|
152
|
+
clearCookies: boolean;
|
|
153
|
+
enableGpu: string;
|
|
154
|
+
blockedUrls: string;
|
|
155
|
+
extraHeaders: string;
|
|
156
|
+
responseModifiers: string;
|
|
157
|
+
downloadResponses: string;
|
|
158
|
+
extraCSS: string;
|
|
159
|
+
cookies: string;
|
|
160
|
+
overridePermissions: string;
|
|
161
|
+
hardwareConcurrency: number;
|
|
162
|
+
debuggingPort: number;
|
|
163
|
+
debuggingAddress: string;
|
|
164
|
+
emulateCpuThrottling: number;
|
|
165
|
+
showStats: boolean;
|
|
166
|
+
statsPath: string;
|
|
167
|
+
detailedStatsPath: string;
|
|
168
|
+
statsInterval: number;
|
|
169
|
+
rtcStatsTimeout: number;
|
|
170
|
+
customMetrics: string;
|
|
171
|
+
prometheusPushgateway: string;
|
|
172
|
+
prometheusPushgatewayJobName: string;
|
|
173
|
+
prometheusPushgatewayAuth: string;
|
|
174
|
+
prometheusPushgatewayGzip: boolean;
|
|
175
|
+
alertRules: string;
|
|
176
|
+
alertRulesOutput: string;
|
|
177
|
+
alertRulesFailPercentile: number;
|
|
178
|
+
pushStatsUrl: string;
|
|
179
|
+
pushStatsId: string;
|
|
180
|
+
serverPort: number;
|
|
181
|
+
serverSecret: string;
|
|
182
|
+
serverUseHttps: boolean;
|
|
183
|
+
serverData: string;
|
|
184
|
+
vmafPath: string;
|
|
185
|
+
vmafPreview: boolean;
|
|
186
|
+
vmafKeepIntermediateFiles: boolean;
|
|
187
|
+
vmafKeepSourceFiles: boolean;
|
|
188
|
+
vmafSkipDuplicated: boolean;
|
|
189
|
+
vmafCrop: string;
|
|
190
|
+
vmafPrepareVideo: string;
|
|
191
|
+
vmafProcessVideo: string;
|
|
192
|
+
vmafVideoCrop: string;
|
|
193
|
+
visqolPath: string;
|
|
194
|
+
visqolKeepSourceFiles: boolean;
|
|
195
|
+
}>;
|
|
106
196
|
export {};
|
package/build/src/config.js
CHANGED
|
@@ -38,11 +38,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
39
|
exports.getConfigDocs = getConfigDocs;
|
|
40
40
|
exports.loadConfig = loadConfig;
|
|
41
|
+
exports.loadConfigFromPrompt = loadConfigFromPrompt;
|
|
41
42
|
const convict_1 = __importStar(require("convict"));
|
|
42
43
|
const convict_format_with_validator_1 = require("convict-format-with-validator");
|
|
43
44
|
const fs_1 = require("fs");
|
|
44
45
|
const os_1 = __importDefault(require("os"));
|
|
45
|
-
const path_1 = require("path");
|
|
46
|
+
const path_1 = __importStar(require("path"));
|
|
46
47
|
const json5_1 = __importDefault(require("json5"));
|
|
47
48
|
const yaml_1 = __importDefault(require("yaml"));
|
|
48
49
|
const toml_1 = __importDefault(require("toml"));
|
|
@@ -149,7 +150,7 @@ The temporary files containing the raw video and audio will be stored at \
|
|
|
149
150
|
\`\${VIDEO_CACHE_PATH}/video.\${VIDEO_FORMAT}\` and \
|
|
150
151
|
\`\${VIDEO_CACHE_PATH}/audio.wav\`.`,
|
|
151
152
|
format: String,
|
|
152
|
-
default: 'https://github.com/vpalmisano/webrtcperf/releases/download/
|
|
153
|
+
default: 'https://github.com/vpalmisano/webrtcperf/releases/download/videos-1.0/kt.mp4',
|
|
153
154
|
env: 'VIDEO_PATH',
|
|
154
155
|
arg: 'video-path',
|
|
155
156
|
},
|
|
@@ -229,7 +230,51 @@ seconds.`,
|
|
|
229
230
|
arg: 'run-duration',
|
|
230
231
|
},
|
|
231
232
|
throttleConfig: {
|
|
232
|
-
doc: `A JSON5 string with a valid
|
|
233
|
+
doc: `A JSON5 string with a valid throttler configuration (https://github.com/vpalmisano/throttler). \
|
|
234
|
+
Example: \
|
|
235
|
+
|
|
236
|
+
\`\`\`javascript
|
|
237
|
+
[{
|
|
238
|
+
sessions: '0-1',
|
|
239
|
+
device: 'eth0',
|
|
240
|
+
protocol: 'udp',
|
|
241
|
+
skipSourcePorts: "443",
|
|
242
|
+
skipDestinationPorts: "443",
|
|
243
|
+
filter: "--sports 443 --dports 443",
|
|
244
|
+
match: 'nbyte("ababa" at 12 layer 1)',
|
|
245
|
+
capture: 'capture.pcap',
|
|
246
|
+
up: {
|
|
247
|
+
rate: 1000,
|
|
248
|
+
delay: 50,
|
|
249
|
+
loss: 5,
|
|
250
|
+
queue: 10,
|
|
251
|
+
},
|
|
252
|
+
down: [
|
|
253
|
+
{ rate: 2000, delay: 50, delayJitter: 10, delayJitterCorrelation: 25, loss: 2, lossBurst: 2, queue: 20 },
|
|
254
|
+
{ rate: 1000, delay: 50, loss: 2, queue: 20, at: 60 },
|
|
255
|
+
]
|
|
256
|
+
}]
|
|
257
|
+
\`\`\`
|
|
258
|
+
- The sessions field represents the sessions IDs range that will be affected by the rule, e.g.: "0-10", "2,4" or simply "2".
|
|
259
|
+
- The device, protocol, up, down fields are optional. When device is not set, the default route device will be used. If protocol is specified ('udp' or 'tcp'), \
|
|
260
|
+
only the packets with the specified protocol will be affected by the shaping rules.
|
|
261
|
+
- The capture field is optional and specifies the pcap file to save the captured packets.
|
|
262
|
+
- With skipSourcePorts and skipDestinationPorts you can specify a comma-separated list of ports that will not be affected by the shaping rules.
|
|
263
|
+
- The filter field is optional and specifies the additional IPTables filter to apply for filtering the packets.
|
|
264
|
+
- The match field is optional and specifies the additional match rule to apply for filtering the packets (https://man7.org/linux/man-pages/man8/tc-ematch.8.html).
|
|
265
|
+
- The up and down fields are optional and they specify the upstream and downstream shaping rules. The possible options for the up and down rules could be:
|
|
266
|
+
- rate: the shaping rate in Kbps;
|
|
267
|
+
- delay: the shaping delay in milliseconds;
|
|
268
|
+
- delayJitter: the shaping delay jitter in milliseconds;
|
|
269
|
+
- delayJitterCorrelation: the shaping delay jitter correlation in milliseconds;
|
|
270
|
+
- loss: the packet loss percentage;
|
|
271
|
+
- lossBurst: the packet loss burst percentage;
|
|
272
|
+
- queue: the shaping queue size in packets;
|
|
273
|
+
- at: the time in seconds when the shaping rule will be applied (default: 0).
|
|
274
|
+
The up and down rules can be specified as a single object or an array of objects.
|
|
275
|
+
When using an array of objects, specify a different "at" value for each of them, in order to apply a sequence of actions; please note that only the specified properties will override previous ones, so you can omit the values that you don't want to change. \
|
|
276
|
+
\
|
|
277
|
+
`,
|
|
233
278
|
format: String,
|
|
234
279
|
nullable: true,
|
|
235
280
|
default: '',
|
|
@@ -406,7 +451,7 @@ calculated using \`Date.now()\``,
|
|
|
406
451
|
arg: 'spawn-rate',
|
|
407
452
|
},
|
|
408
453
|
showPageLog: {
|
|
409
|
-
doc: `If \`true\`, the pages console logs will be shown on console.`,
|
|
454
|
+
doc: `If \`true\`, the pages console logs will be shown on console. Set to false to disable the page logs.`,
|
|
410
455
|
format: 'Boolean',
|
|
411
456
|
default: true,
|
|
412
457
|
env: 'SHOW_PAGE_LOG',
|
|
@@ -696,13 +741,13 @@ service (example: "http://127.0.0.1:9091").`,
|
|
|
696
741
|
env: 'ALERT_RULES',
|
|
697
742
|
arg: 'alert-rules',
|
|
698
743
|
},
|
|
699
|
-
|
|
700
|
-
doc: `The alert rules report output filename.`,
|
|
744
|
+
alertRulesOutput: {
|
|
745
|
+
doc: `The alert rules report output filename. If the file ends with .log extension, a detailed log will be generated, otherwise a JSON report will be generated.`,
|
|
701
746
|
format: String,
|
|
702
747
|
nullable: true,
|
|
703
748
|
default: '',
|
|
704
|
-
env: '
|
|
705
|
-
arg: 'alert-rules-
|
|
749
|
+
env: 'ALERT_RULES_OUTPUT',
|
|
750
|
+
arg: 'alert-rules-output',
|
|
706
751
|
},
|
|
707
752
|
alertRulesFailPercentile: {
|
|
708
753
|
doc: `The alert rules report fails percentile (0-100). With the default value the \
|
|
@@ -801,7 +846,7 @@ the reference and degraded versions.`,
|
|
|
801
846
|
vmafCrop: {
|
|
802
847
|
doc: `If set, the reference and degraded videos will be cropped using the specified configuration in JSON5 format. \
|
|
803
848
|
Crop configuration should be expressed using the ffmpeg crop filter syntax (https://ffmpeg.org/ffmpeg-filters.html#crop). \
|
|
804
|
-
E.g. \`{ "Participant-000001_recv-by_Participant-000000
|
|
849
|
+
E.g. \`{ "Participant-000001_recv-by_Participant-000000": { ref: { w: "iw-10", h: "ih-5" }, deg: { w: "200", h: "200" } } }\``,
|
|
805
850
|
format: String,
|
|
806
851
|
nullable: true,
|
|
807
852
|
default: '',
|
|
@@ -906,7 +951,13 @@ async function loadConfig(filePath, values) {
|
|
|
906
951
|
}
|
|
907
952
|
else if ((0, fs_1.existsSync)(filePath)) {
|
|
908
953
|
log.debug(`Loading config from local file: ${filePath}`);
|
|
909
|
-
|
|
954
|
+
if (filePath.endsWith('.js') || filePath.endsWith('.mjs')) {
|
|
955
|
+
const module = await import(/* webpackIgnore: true */ path_1.default.resolve(filePath));
|
|
956
|
+
configSchema.load(await module.default());
|
|
957
|
+
}
|
|
958
|
+
else {
|
|
959
|
+
configSchema.loadFile(filePath);
|
|
960
|
+
}
|
|
910
961
|
}
|
|
911
962
|
}
|
|
912
963
|
else if (values) {
|
|
@@ -922,4 +973,57 @@ async function loadConfig(filePath, values) {
|
|
|
922
973
|
log.debug('Using config:', config);
|
|
923
974
|
return config;
|
|
924
975
|
}
|
|
976
|
+
function getFunctionDeclaration() {
|
|
977
|
+
const properties = {};
|
|
978
|
+
const required = [];
|
|
979
|
+
const schema = configSchema.getSchema();
|
|
980
|
+
Object.entries(schema._cvtProperties).forEach(([name, value]) => {
|
|
981
|
+
const { format, doc, nullable } = value;
|
|
982
|
+
properties[name] = {
|
|
983
|
+
type: format,
|
|
984
|
+
description: doc,
|
|
985
|
+
nullable,
|
|
986
|
+
};
|
|
987
|
+
});
|
|
988
|
+
return {
|
|
989
|
+
name: 'webrtcperf',
|
|
990
|
+
description: 'Starts a webrtcperf test.',
|
|
991
|
+
parameters: {
|
|
992
|
+
type: 'object',
|
|
993
|
+
properties,
|
|
994
|
+
required,
|
|
995
|
+
},
|
|
996
|
+
};
|
|
997
|
+
}
|
|
998
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
999
|
+
const { GoogleGenAI } = require('@google/genai');
|
|
1000
|
+
async function loadConfigFromPrompt(prompt) {
|
|
1001
|
+
log.debug(`loadConfigFromPrompt: "${prompt}"`);
|
|
1002
|
+
if (!process.env.GEMINI_API_KEY) {
|
|
1003
|
+
throw new Error('GEMINI_API_KEY environment variable is not set. Please set it to use the Google GenAI API.');
|
|
1004
|
+
}
|
|
1005
|
+
const ai = new GoogleGenAI({ apiKey: process.env.GEMINI_API_KEY });
|
|
1006
|
+
const response = await ai.models.generateContent({
|
|
1007
|
+
model: 'gemini-2.5-flash',
|
|
1008
|
+
contents: prompt,
|
|
1009
|
+
config: {
|
|
1010
|
+
tools: [
|
|
1011
|
+
{
|
|
1012
|
+
functionDeclarations: [getFunctionDeclaration()],
|
|
1013
|
+
},
|
|
1014
|
+
],
|
|
1015
|
+
thinkingConfig: {
|
|
1016
|
+
thinkingBudget: 0,
|
|
1017
|
+
},
|
|
1018
|
+
},
|
|
1019
|
+
});
|
|
1020
|
+
if (response.functionCalls && response.functionCalls.length > 0) {
|
|
1021
|
+
const functionCall = response.functionCalls[0];
|
|
1022
|
+
log.info('Using function call:', functionCall.name, functionCall.args);
|
|
1023
|
+
return loadConfig(undefined, functionCall.args);
|
|
1024
|
+
}
|
|
1025
|
+
else {
|
|
1026
|
+
throw new Error('No function call found in the response. Please check the prompt and try again.');
|
|
1027
|
+
}
|
|
1028
|
+
}
|
|
925
1029
|
//# sourceMappingURL=config.js.map
|
package/build/src/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/config.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAo1BA,sCAEC;AAWD,gCAgCC;AAj4BD,mDAA6C;AAC7C,iFAA8D;AAC9D,2BAA+B;AAC/B,4CAAmB;AACnB,+BAA2B;AAC3B,kDAAyB;AACzB,gDAAuB;AACvB,gDAAuB;AAEvB,iEAAiE;AACjE,MAAM,SAAS,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAA;AAE3C,mCAA6C;AAC7C,MAAM,GAAG,GAAG,IAAA,cAAM,EAAC,mBAAmB,CAAC,CAAA;AAEvC,MAAM,KAAK,GAAG;IACZ,IAAI,EAAE,OAAO;IACb,MAAM,EAAE,CAAC,CAAS,EAAE,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC;IACpC,QAAQ,EAAE,CAAC,CAAS,EAAE,EAAE;QACtB,IAAI,C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;QAChD,YAAY,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;IACvB,CAAC;IAED,YAAY,CAAC,QAAQ,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC,CAAA;IAC5C,MAAM,MAAM,GAAG,YAAY,CAAC,aAAa,EAAE,CAAA;IAE3C,GAAG,CAAC,KAAK,CAAC,eAAe,EAAE,MAAM,CAAC,CAAA;IAClC,OAAO,MAAM,CAAA;AACf,CAAC","sourcesContent":["import convict, { addFormats } from 'convict'\nimport { ipaddress, url } from 'convict-format-with-validator'\nimport { existsSync } from 'fs'\nimport os from 'os'\nimport { join } from 'path'\nimport json5 from 'json5'\nimport yaml from 'yaml'\nimport toml from 'toml'\n\n// eslint-disable-next-line @typescript-eslint/no-require-imports\nconst puppeteer = require('puppeteer-core')\n\nimport { downloadUrl, logger } from './utils'\nconst log = logger('webrtcperf:config')\n\nconst float = {\n name: 'float',\n coerce: (v: string) => parseFloat(v),\n validate: (v: number) => {\n if (!Number.isFinite(v)) throw new Error(`Invalid float: ${v}`)\n },\n}\n\nconst index = {\n name: 'index',\n coerce: (v: unknown) => v,\n validate: (v: boolean | string | number) => {\n if (typeof v === 'string') {\n if (v === 'true' || v === 'false' || v === '') return\n if (v.includes('-')) {\n v.split('-').forEach(n => {\n if (isNaN(parseInt(n)) || !isFinite(parseInt(n))) throw new Error(`Invalid string index: ${n}`)\n })\n return\n }\n if (v.includes(',')) {\n v.split(',').forEach(n => {\n if (isNaN(parseInt(n)) || !isFinite(parseInt(n))) throw new Error(`Invalid string index: ${n}`)\n })\n return\n }\n if (isNaN(parseInt(v)) || !isFinite(parseInt(v))) throw new Error(`Invalid string index: ${v}`)\n return\n } else if (typeof v === 'number' || typeof v === 'boolean') {\n return\n }\n throw new Error(`Invalid index: \"${v}\" (type: ${typeof v})`)\n },\n}\n\naddFormats({ ipaddress, url, float, index })\n\nconvict.addParser([\n { extension: 'json', parse: json5.parse },\n { extension: ['yml', 'yaml'], parse: yaml.parse },\n { extension: 'toml', parse: toml.parse },\n])\n\n// config schema\nconst configSchema = convict({\n url: {\n doc: `The page url to load.`,\n format: String,\n default: '',\n nullable: true,\n env: 'URL',\n arg: 'url',\n },\n urlQuery: {\n doc: `The query string to append to the page url; the following template \\\nvariables are replaced: \\`$p\\` the process pid, \\`$s\\` the session index, \\\n\\`$S\\` the total sessions, \\`$t\\` the tab index, \\`$T\\` the total tabs per \\\nsession, \\`$i\\` the tab absolute index.`,\n format: String,\n default: '',\n nullable: true,\n env: 'URL_QUERY',\n arg: 'url-query',\n },\n customUrlHandler: {\n doc: `This argument specifies the file path for the custom page URL handler that will be exported by default. \\\nThe custom page URL handler allows you to define custom URLs that can be used to open your application. \\\nThe handler function will be called with the following variables: \\\n- sessions: the total number of sessions; \\\n- tabsPerSession: the total number of tabs per session; \\\n- id: the session global index (0-indexed); \\\n- index: the tab global index (0-indexed); \\\n- tabIndex: the tab index in the current session (0-indexed); \\\n- pid: the process pid; \\\n- env: the environment variables object; \\\n- params: the script parameters object. \\\nYou can use these variables to create custom URL schemes that suit your application's needs.`,\n format: String,\n default: '',\n nullable: true,\n env: 'CUSTOM_URL_HANDLER',\n arg: 'custom-url-handler',\n },\n // fake video/audio\n videoPath: {\n doc: `The fake video path; if set, the video will be used as fake \\\nmedia source. It accepts a single path or a comma-separated list of videos \\\npaths that will be used in round-robin by the started sessions. \\\nThe docker pre-built image contains a 2 minutes video sequence stored at \\\n\\`/app/video.mp4\\`. \\\nIt accepts a local file, an http endpoint or a string starting with\n\\`generate:\\` (example: \\`generate:null\\` will generate a black video with \\\nsilent audio). \\\nThe temporary files containing the raw video and audio will be stored at \\\n\\`\\${VIDEO_CACHE_PATH}/video.\\${VIDEO_FORMAT}\\` and \\\n\\`\\${VIDEO_CACHE_PATH}/audio.wav\\`.`,\n format: String,\n default: 'https://github.com/vpalmisano/webrtcperf/releases/download/v2.0.4/video.mp4',\n env: 'VIDEO_PATH',\n arg: 'video-path',\n },\n videoWidth: {\n doc: `The fake video resize width.`,\n format: 'nat',\n default: 1280,\n env: 'VIDEO_WIDTH',\n arg: 'video-width',\n },\n videoHeight: {\n doc: `The fake video resize height.`,\n format: 'nat',\n default: 720,\n env: 'VIDEO_HEIGHT',\n arg: 'video-height',\n },\n videoFramerate: {\n doc: `The fake video framerate.`,\n format: 'nat',\n default: 25,\n env: 'VIDEO_FRAMERATE',\n arg: 'video-framerate',\n },\n videoSeek: {\n doc: `The fake audio/video seek position in seconds.`,\n format: 'nat',\n default: 0,\n env: 'VIDEO_SEEK',\n arg: 'video-seek',\n },\n videoDuration: {\n doc: `The fake audio/video duration in seconds.`,\n format: 'nat',\n default: 120,\n env: 'VIDEO_DURATION',\n arg: 'video-duration',\n },\n videoCacheRaw: {\n doc: `If the temporary video and audio raw files can be reused across \\\nmultiple runs.`,\n format: 'Boolean',\n default: true,\n env: 'VIDEO_CACHE_RAW',\n arg: 'video-cache-raw',\n },\n videoCachePath: {\n doc: `The path where the video and audio raw files are stored.`,\n format: String,\n default: join(os.homedir(), '.webrtcperf/cache'),\n env: 'VIDEO_CACHE_PATH',\n arg: 'video-cache-path',\n },\n videoFormat: {\n doc: `The fake video file format presented to the browser.`,\n format: ['y4m', 'mjpeg'],\n default: 'y4m',\n env: 'VIDEO_FORMAT',\n arg: 'video-format',\n },\n useFakeMedia: {\n doc: `If true, the audio/video/screenshare will be generated using the browser fake device.\nOtherwise, the audio and video streams will be captured from a video element attached to the page, \nwhile the screenshare will be captured from a new browser tab.`,\n format: 'Boolean',\n default: true,\n env: 'USE_FAKE_MEDIA',\n arg: 'use-fake-media',\n },\n //\n runDuration: {\n doc: `If greater than 0, the test will stop after the provided number of \\\nseconds.`,\n format: 'nat',\n default: 0,\n env: 'RUN_DURATION',\n arg: 'run-duration',\n },\n throttleConfig: {\n doc: `A JSON5 string with a valid throtter configuration (https://github.com/vpalmisano/throttler).`,\n format: String,\n nullable: true,\n default: '',\n env: 'THROTTLE_CONFIG',\n arg: 'throttle-config',\n },\n randomAudioPeriod: {\n doc: `If not zero, it specifies the maximum period in seconds after which \\\na new random active session is selected, enabling the getUserMedia audio tracks in \\\nthat session and disabling all of the others.`,\n format: 'nat',\n default: 0,\n env: 'RANDOM_AUDIO_PERIOD',\n arg: 'random-audio-period',\n },\n randomAudioProbability: {\n doc: `When using random audio period, it defines the probability % that \\\nthe selected audio will be activated (value: 0-100).`,\n format: 'nat',\n default: 100,\n env: 'RANDOM_AUDIO_PROBABILITY',\n arg: 'random-audio-probability',\n },\n randomAudioRange: {\n doc: `When using random audio period, it defines the session indexes \\\nto be included into the random selection (default: include all the sessions).`,\n format: 'index',\n default: 'true',\n nullable: true,\n env: 'RANDOM_AUDIO_RANGE',\n arg: 'random-audio-range',\n },\n // Session config\n chromiumPath: {\n doc: `The Chromium executable path.`,\n format: String,\n nullable: true,\n default: '',\n env: 'CHROMIUM_PATH',\n arg: 'chromium-path',\n },\n chromiumVersion: {\n doc: `The Chromium version. It will be downloaded if the chromium \\\npath is not provided.`,\n format: String,\n nullable: false,\n default: puppeteer.PUPPETEER_REVISIONS.chrome,\n env: 'CHROMIUM_VERSION',\n arg: 'chromium-version',\n },\n chromiumUrl: {\n doc: `The remote Chromium URL (\\`http://HOST:PORT\\`).\nIf provided, the remote instance will be used instead of running a local\nchromium process.`,\n format: String,\n default: '',\n nullable: true,\n env: 'CHROMIUM_URL',\n arg: 'chromium-url',\n },\n chromiumFieldTrials: {\n doc: `Chromium additional field trials.`,\n format: String,\n nullable: true,\n default: '',\n env: 'CHROMIUM_FIELD_TRIALS',\n arg: 'chromium-field-trials',\n },\n windowWidth: {\n doc: `The browser window width.`,\n format: 'nat',\n default: 1920,\n env: 'WINDOW_WIDTH',\n arg: 'window-width',\n },\n windowHeight: {\n doc: `The browser window height.`,\n format: 'nat',\n default: 1080,\n env: 'WINDOW_HEIGHT',\n arg: 'window-height',\n },\n deviceScaleFactor: {\n doc: `The browser device scale factor.`,\n format: 'float',\n default: 1,\n env: 'DEVICE_SCALE_FACTOR',\n arg: 'device-scale-factor',\n },\n maxVideoDecoders: {\n doc: `Specifies the maximum number of concurrent WebRTC video decoder \\\ninstances that can be created on the same host.\nIf set it will disable the received video resolution and jitter buffer stats. \\\nThis option is supported only when using the custom chromium build. \\\nThe total decoders count is stored into the virtual file \\`/dev/shm/chromium-video-decoders\\``,\n format: Number,\n default: -1,\n env: 'MAX_VIDEO_DECODERS',\n arg: 'max-video-decoders',\n },\n maxVideoDecodersRange: {\n doc: `It applies the max video decoders option to the sessions included into this list (default: include all the sessions)`,\n format: 'index',\n default: 'true',\n nullable: true,\n env: 'MAX_VIDEO_DECODERS_RANGE',\n arg: 'max-video-decoders-range',\n },\n incognito: {\n doc: `Runs the browser in incognito mode.`,\n format: 'Boolean',\n default: false,\n env: 'INCOGNITO',\n arg: 'incognito',\n },\n display: {\n doc: `If unset, the browser will run in headless mode, otherwise it will run in normal windowed mode.\nWhen running on MacOS or Windows, set it to any not-empty string.\nOn Linux, set it to a valid X server \\`DISPLAY\\` string (e.g. \\`:0\\`).`,\n format: String,\n default: '',\n nullable: true,\n arg: 'display',\n },\n /* audioRedForOpus: {\n doc: `Enables RED for OPUS codec (experimental).`,\n format: 'Boolean',\n default: false,\n env: 'AUDIO_RED_FOR_OPUS',\n arg: 'audio-red-for-opus',\n }, */\n sessions: {\n doc: `The number of browser sessions to start.`,\n format: 'nat',\n default: 0,\n env: 'SESSIONS',\n arg: 'sessions',\n },\n tabsPerSession: {\n doc: `The number of tabs to open in each browser session.`,\n format: 'nat',\n default: 1,\n env: 'TABS_PER_SESSION',\n arg: 'tabs-per-session',\n },\n startSessionId: {\n doc: `The starting ID assigned to sessions.`,\n format: 'nat',\n default: 0,\n env: 'START_SESSION_ID',\n arg: 'start-session-id',\n },\n startTimestamp: {\n doc: `The start timestamp (in milliseconds). If 0, the value will be \\\ncalculated using \\`Date.now()\\``,\n format: 'nat',\n default: 0,\n env: 'START_TIMESTAMP',\n arg: 'start-timestamp',\n },\n enableDetailedStats: {\n doc: `If detailed participant metrics values should be collected.`,\n format: 'index',\n default: '0-24',\n nullable: true,\n env: 'ENABLE_DETAILED_STATS',\n arg: 'enable-detailed-stats',\n },\n spawnRate: {\n doc: `The pages spawn rate (pages/s).`,\n format: 'float',\n default: 1,\n env: 'SPAWN_RATE',\n arg: 'spawn-rate',\n },\n showPageLog: {\n doc: `If \\`true\\`, the pages console logs will be shown on console.`,\n format: 'Boolean',\n default: true,\n env: 'SHOW_PAGE_LOG',\n arg: 'show-page-log',\n },\n pageLogFilter: {\n doc: `If set, only the logs with the matching text will be printed \\\non the console. Regexp string allowed.`,\n format: String,\n default: '',\n nullable: true,\n env: 'PAGE_LOG_FILTER',\n arg: 'page-log-filter',\n },\n pageLogPath: {\n doc: `If set, the page console logs will be saved on the selected file path.`,\n format: String,\n default: '',\n nullable: true,\n env: 'PAGE_LOG_PATH',\n arg: 'page-log-path',\n },\n enableBrowserLogging: {\n doc: `It enables the Chromium browser logging for the specified session indexes. It requires the page log path option to be set. `,\n format: 'index',\n nullable: true,\n default: '',\n env: 'ENABLE_BROWSER_LOGGING',\n arg: 'enable-browser-logging',\n },\n userAgent: {\n doc: `The user agent override.`,\n format: String,\n default: 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36',\n nullable: true,\n env: 'USER_AGENT',\n arg: 'user-agent',\n },\n scriptPath: {\n doc: `One or more JavaScript file paths (comma-separated). \\\nIf set, the files contents will be executed inside each opened tab page; \\\nthe following global variables will be attached to the \\`webrtcperf\\` global object: \\\n\\`WEBRTC_PERF_SESSION\\` the session number (0-indexed); \\\n\\`WEBRTC_PERF_TAB\\` the tab number inside the same session (0-indexed); \\\n\\`WEBRTC_PERF_INDEX\\` the page absolute index (0-indexed). \\\n`,\n format: String,\n default: '',\n env: 'SCRIPT_PATH',\n arg: 'script-path',\n },\n scriptParams: {\n doc: `Additional parameters (in JSON format) that will be exposed into\nthe page context as \\`webrtcperf.params\\`.`,\n format: String,\n nullable: true,\n default: '',\n env: 'SCRIPT_PARAMS',\n arg: 'script-params',\n },\n disabledVideoCodecs: {\n doc: `A string with the video codecs to disable (comma-separated); e.g. \\`vp9,av1\\``,\n format: String,\n nullable: true,\n default: '',\n env: 'DISABLED_VIDEO_CODECS',\n arg: 'disabled-video-codecs',\n },\n localStorage: {\n doc: `A JSON string with the \\`localStorage\\` object to be set on page \\\nload.`,\n format: String,\n nullable: true,\n default: '',\n env: 'LOCAL_STORAGE',\n arg: 'local-storage',\n },\n sessionStorage: {\n doc: `A JSON string with the \\`sessionStorage\\` object to be set on page \\\nload.`,\n format: String,\n nullable: true,\n default: '',\n env: 'SESSION_STORAGE',\n arg: 'session-storage',\n },\n clearCookies: {\n doc: `If true, all the page cookies are cleared.`,\n format: 'Boolean',\n default: false,\n env: 'CLEAR_COOKIES',\n arg: 'clear-cookies',\n },\n enableGpu: {\n doc: `It enables the GPU acceleration (experimental). Set to \"desktop\" to \\\nuse the host X server instance.`,\n format: String,\n nullable: true,\n default: '',\n env: 'ENABLE_GPU',\n arg: 'enable-gpu',\n },\n blockedUrls: {\n doc: `A comma-separated list of request URLs that will be automatically \\\nblocked.`,\n format: String,\n nullable: true,\n default: '',\n env: 'BLOCKED_URLS',\n arg: 'blocked-urls',\n },\n extraHeaders: {\n doc: `A dictionary of headers keyed by the url in JSON5 format (e.g. \\\n\\`{ \"https://url.com/*\": { \"header-name\": \"value\" } }\\`).`,\n format: String,\n nullable: true,\n default: '',\n env: 'EXTRA_HEADERS',\n arg: 'extra-headers',\n },\n responseModifiers: {\n doc: `A dictionary of content replacements keyed by the url in JSON5 format.\nExamples:\n- replace strings using a regular expression:\n \\`{ \"https://url.com/*\": [{ search: \"searchString\": replace: \"anotherString\" }] }\\`\n- completely replace the content:\n \\`{ \"https://url.com/file.js\": [{ file: \"path/to/newFile.js\" }] }\\`\n`,\n format: String,\n nullable: true,\n default: '',\n env: 'RESPONSE_MODIFIERS',\n arg: 'response-modifiers',\n },\n downloadResponses: {\n doc: `An array of url responses that will be saved to the disk, keyed by the url in JSON5 format.\nExample: \\`[{ urlPattern: \"https://url.com/*\", output: \"save/directory\" }]\\`\n`,\n format: String,\n nullable: true,\n default: '',\n env: 'DOWNLOAD_RESPONSES',\n arg: 'download-responses',\n },\n extraCSS: {\n doc: `A string with a CSS styles to inject into each page. \\\nRules containing \"important\" will be replaced with \"!important\".`,\n format: String,\n nullable: true,\n default: '',\n env: 'EXTRA_CSS',\n arg: 'extra-css',\n },\n cookies: {\n doc: `A string with an array of [CookieParam](https://pptr.dev/api/puppeteer.cookieparam) to set into each page in JSON5 format.`,\n format: String,\n nullable: true,\n default: '',\n env: 'COOKIES',\n arg: 'cookies',\n },\n overridePermissions: {\n doc: `A comma-separated list of permissions to grant to the opened url.`,\n format: String,\n nullable: true,\n default: '',\n env: 'OVERRIDE_PERMISSIONS',\n arg: 'override-permissions',\n },\n hardwareConcurrency: {\n doc: `When set, it overrides the navigator.hardwareConcurrency property.`,\n format: 'nat',\n default: 0,\n env: 'HARDWARE_CONCURRENCY',\n arg: 'hardware-concurrency',\n },\n debuggingPort: {\n doc: `The chrome debugging port. If this value != 0, the chrome instance \\\nwill listen on the provided port + the start-session-id value.`,\n format: 'nat',\n default: 0,\n env: 'DEBUGGING_PORT',\n arg: 'debugging-port',\n },\n debuggingAddress: {\n doc: `The chrome debugging listening address. If unset, the network default interface address will be used.`,\n format: String,\n nullable: true,\n default: '127.0.0.1',\n env: 'DEBUGGING_ADDRESS',\n arg: 'debugging-address',\n },\n emulateCpuThrottling: {\n doc: `The emulated CPU throttling factor. If set, the page will be throttled to the specified factor.`,\n format: 'nat',\n default: 0,\n env: 'EMULATE_CPU_THROTTLING',\n arg: 'emulate-cpu-throttling',\n },\n // stats config\n showStats: {\n doc: `If the statistics should be displayed on the console output.`,\n format: 'Boolean',\n default: true,\n env: 'SHOW_STATS',\n arg: 'show-stats',\n },\n statsPath: {\n doc: `The log file path; if set, the stats will be written in \\\na .csv file inside that file.`,\n format: String,\n default: '',\n env: 'STATS_PATH',\n arg: 'stats-path',\n },\n detailedStatsPath: {\n doc: `The log file path; if set, the detailed stats will be written in \\\na .csv file inside that file.`,\n format: String,\n default: '',\n env: 'DETAILED_STATS_PATH',\n arg: 'detailed-stats-path',\n },\n statsInterval: {\n doc: `The stats collect interval in seconds. It should be lower than the \\\nPrometheus scraping interval.`,\n format: 'nat',\n default: 15,\n env: 'STATS_INTERVAL',\n arg: 'stats-interval',\n },\n rtcStatsTimeout: {\n doc: `The timeout in seconds after which the RTC stats coming from inactive\\\n hosts are removed. It should be higher than the \\`statsInterval\\` value.`,\n format: 'nat',\n default: 60,\n env: 'RTC_STATS_TIMEOUT',\n arg: 'rtc-stats-timeout',\n },\n customMetrics: {\n doc: `A dictionary of custom metrics keys in JSON5 format (e.g. \\\n'{ statName1: { labels: [\"label1\"] } }').`,\n format: String,\n nullable: true,\n default: '',\n env: 'CUSTOM_METRICS',\n arg: 'custom-metrics',\n },\n //\n prometheusPushgateway: {\n doc: `If set, logs are sent to the specified Prometheus Pushgateway \\\nservice (example: \"http://127.0.0.1:9091\").`,\n format: 'String',\n default: '',\n nullable: true,\n env: 'PROMETHEUS_PUSHGATEWAY',\n arg: 'prometheus-pushgateway',\n },\n prometheusPushgatewayJobName: {\n doc: `The Prometheus Pushgateway job name.`,\n format: 'String',\n default: 'default',\n env: 'PROMETHEUS_PUSHGATEWAY_JOB_NAME',\n arg: 'prometheus-pushgateway-job-name',\n },\n prometheusPushgatewayAuth: {\n doc: `The Prometheus Pushgateway basic auth (username:password).`,\n format: 'String',\n default: '',\n nullable: true,\n env: 'PROMETHEUS_PUSHGATEWAY_AUTH',\n arg: 'prometheus-pushgateway-auth',\n },\n prometheusPushgatewayGzip: {\n doc: `Allows to use gzip encoded pushgateway requests.`,\n format: 'Boolean',\n default: true,\n env: 'PROMETHEUS_PUSHGATEWAY_GZIP',\n arg: 'prometheus-pushgateway-gzip',\n },\n //\n alertRules: {\n doc: `Alert rules definition (in JSON format).`,\n format: String,\n nullable: true,\n default: '',\n env: 'ALERT_RULES',\n arg: 'alert-rules',\n },\n alertRulesFilename: {\n doc: `The alert rules report output filename.`,\n format: String,\n nullable: true,\n default: '',\n env: 'ALERT_RULES_FILENAME',\n arg: 'alert-rules-filename',\n },\n alertRulesFailPercentile: {\n doc: `The alert rules report fails percentile (0-100). With the default value the \\\nalert will be successful only when at least 95% of the checks pass.`,\n format: 'nat',\n nullable: false,\n default: 95,\n env: 'ALERT_RULES_FAIL_PERCENTILE',\n arg: 'alert-rules-fail-percentile',\n },\n pushStatsUrl: {\n doc: `The URL to push the collected stats.`,\n format: String,\n nullable: true,\n default: '',\n env: 'PUSH_STATS_URL',\n arg: 'push-stats-url',\n },\n pushStatsId: {\n doc: `The ID of the collected stats to push.`,\n format: String,\n nullable: true,\n default: 'default',\n env: 'PUSH_STATS_ID',\n arg: 'push-stats-id',\n },\n // server config\n serverPort: {\n doc: `The HTTP server listening port.`,\n format: 'nat',\n nullable: true,\n default: 0,\n env: 'SERVER_PORT',\n arg: 'server-port',\n },\n serverSecret: {\n doc: `The HTTP server basic auth secret. The auth user name is set to \\`admin\\` by default.`,\n format: String,\n default: 'secret',\n env: 'SERVER_SECRET',\n arg: 'server-secret',\n },\n serverUseHttps: {\n doc: `If true, the server will use the HTTPS protocol.`,\n format: 'Boolean',\n default: false,\n env: 'SERVER_USE_HTTPS',\n arg: 'server-use-https',\n },\n serverData: {\n doc: `An optional path that the HTTP server will expose with the /data endpoint.`,\n format: String,\n nullable: true,\n default: '',\n env: 'SERVER_DATA',\n arg: 'server-data',\n },\n // VMAF config\n vmafPath: {\n doc: `When set, it runs the VMAF calculator for the video files saved under the provided directory path.`,\n format: String,\n nullable: true,\n default: '',\n env: 'VMAF_PATH',\n arg: 'vmaf-path',\n },\n vmafPreview: {\n doc: `If true, for each VMAF comparison it creates a side-by-side video with \\\nthe reference and degraded versions.`,\n format: 'Boolean',\n default: false,\n env: 'VMAF_PREVIEW',\n arg: 'vmaf-preview',\n },\n vmafKeepIntermediateFiles: {\n doc: `If true, the VMAF intermediate files will not be deleted.`,\n format: 'Boolean',\n default: false,\n env: 'VMAF_KEEP_INTERMEDIATE_FILES',\n arg: 'vmaf-keep-intermediate-files',\n },\n vmafKeepSourceFiles: {\n doc: `If true, the VMAF source files will not be deleted.`,\n format: 'Boolean',\n default: true,\n env: 'VMAF_KEEP_SOURCE_FILES',\n arg: 'vmaf-keep-source-files',\n },\n vmafSkipDuplicated: {\n doc: `If true, the VMAF will skip duplicated recognized frames.`,\n format: 'Boolean',\n default: false,\n env: 'VMAF_SKIP_DUPLICATED',\n arg: 'vmaf-skip-duplicated',\n },\n vmafCrop: {\n doc: `If set, the reference and degraded videos will be cropped using the specified configuration in JSON5 format. \\\nCrop configuration should be expressed using the ffmpeg crop filter syntax (https://ffmpeg.org/ffmpeg-filters.html#crop). \\\nE.g. \\`{ \"Participant-000001_recv-by_Participant-000000': { ref: { w: \"iw-10\", h: \"ih-5\" }, deg: { w: \"200\", h: \"200\" } } }\\``,\n format: String,\n nullable: true,\n default: '',\n env: 'VMAF_CROP',\n arg: 'vmaf-crop',\n },\n vmafPrepareVideo: {\n doc: `When set, it prepares the selected video applying a timestamp overlay on top of it. \\\nThe filename must be provided in the format \\`<video path>,<ID>\\`, where the selected ID will be used unique video identifier in the overlay.`,\n format: String,\n nullable: true,\n default: '',\n env: 'VMAF_PREPARE_VIDEO',\n arg: 'vmaf-prepare-video',\n },\n vmafProcessVideo: {\n doc: `When set, it runs the VMAF video preprocessor, that converts a video file into the IVF format with timestamps matching the overlay recognition. \\\nThe filename must contain a \\`recv\\` or \\`send\\` string to identify if the video was a reference (send) or a degraded version (recv), e.g. \\`Participant1_recv.mp4\\`.`,\n format: String,\n nullable: true,\n default: '',\n env: 'VMAF_PROCESS_VIDEO',\n arg: 'vmaf-process-video',\n },\n vmafVideoCrop: {\n doc: `If set, the vmaf prepared/processed video will be cropped using the specified configuration in JSON5 format. \\\nCrop configuration should be expressed using the ffmpeg crop filter syntax (https://ffmpeg.org/ffmpeg-filters.html#crop). \\\nE.g. \\`{ w: \"iw-10\", h: \"ih-5\", x: \"10\", y: '5' }\\``,\n format: String,\n nullable: true,\n default: '',\n env: 'VMAF_VIDEO_CROP',\n arg: 'vmaf-video-crop',\n },\n // VISQOL config\n visqolPath: {\n doc: `When set, it runs the visqol calculator for the audio files saved under the provided directory path.`,\n format: String,\n nullable: true,\n default: '',\n env: 'VISQOL_PATH',\n arg: 'visqol-path',\n },\n visqolKeepSourceFiles: {\n doc: `If true, the visqol source files will not be deleted.`,\n format: 'Boolean',\n default: true,\n env: 'VISQOL_KEEP_SOURCE_FILES',\n arg: 'visqol-keep-source-files',\n },\n})\n\ntype ConfigDocs = Record<string, { doc: string; format: string; default: string }>\n\n/**\n * Formats the schema documentation, calling the same function recursively.\n * @param docs the documentation object to extend\n * @param property the root property\n * @param schema the config schema fragment\n * @return the documentation object\n */\nfunction formatDocs(\n docs: ConfigDocs,\n property: string | null,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n schema: any,\n): ConfigDocs {\n if (schema._cvtProperties) {\n Object.entries(schema._cvtProperties).forEach(([name, value]) => {\n formatDocs(docs, `${property ? `${property}.` : ''}${name}`, value)\n })\n return docs\n }\n\n if (property) {\n docs[property] = {\n doc: schema.doc,\n format: JSON.stringify(schema.format, null, 2),\n default: JSON.stringify(schema.default, null, 2),\n }\n }\n return docs\n}\n\n/**\n * It returns the formatted configuration docs.\n */\nexport function getConfigDocs(): ConfigDocs {\n return formatDocs({}, null, configSchema.getSchema())\n}\n\nconst _schemaProperties = configSchema.getProperties()\n\n/** [[include:config.md]] */\nexport type Config = typeof _schemaProperties\n\n/**\n * Loads the config object.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport async function loadConfig(filePath?: string, values?: any): Promise<Config> {\n if (filePath) {\n if (filePath.startsWith('http')) {\n log.debug(`Loading config from url: ${filePath}`)\n const res = await downloadUrl(filePath)\n if (!res?.data) {\n throw new Error(`Failed to download configuration from: ${filePath}`)\n }\n const values =\n res.contentType === 'application/x-yaml'\n ? yaml.parse(res.data)\n : res.contentType === 'application/toml'\n ? toml.parse(res.data)\n : json5.parse(res.data)\n configSchema.load(values)\n } else if (existsSync(filePath)) {\n log.debug(`Loading config from local file: ${filePath}`)\n configSchema.loadFile(filePath)\n }\n } else if (values) {\n log.debug('Loading config from values.')\n configSchema.load(values)\n } else {\n log.debug('Loading config from default values.')\n configSchema.load({})\n }\n\n configSchema.validate({ allowed: 'strict' })\n const config = configSchema.getProperties()\n\n log.debug('Using config:', config)\n return config\n}\n"]}
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/config.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAg4BA,sCAEC;AAWD,gCAqCC;AA8BD,oDA2BC;AA3+BD,mDAAwD;AACxD,iFAA8D;AAC9D,2BAA+B;AAC/B,4CAAmB;AACnB,6CAAiC;AACjC,kDAAyB;AACzB,gDAAuB;AACvB,gDAAuB;AAEvB,iEAAiE;AACjE,MAAM,SAAS,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAA;AAE3C,mCAA6C;AAC7C,MAAM,GAAG,GAAG,IAAA,cAAM,EAAC,mBAAmB,CAAC,CAAA;AAEvC,MAAM,KAAK,GAAG;IACZ,IAAI,EAAE,OAAO;IACb,MAAM,EAAE,CAAC,CAAS,EAAE,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC;IACpC,QAAQ,EAAE,CAAC,CAAS,EAAE,EAAE;QACtB,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC;YAAE,MAAM,IAAI,KAAK,CAAC,kBAAkB,CAAC,EAAE,CAAC,CAAA;IACjE,CAAC;CACF,CAAA;AAED,MAAM,KAAK,GAAG;IACZ,IAAI,EAAE,OAAO;IACb,MAAM,EAAE,CAAC,CAAU,EAAE,EAAE,CAAC,CAAC;IACzB,QAAQ,EAAE,CAAC,CAA4B,EAAE,EAA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O,CAAC,GAAG,CAAC,cAAc,EAAE,CAAC;QAChC,MAAM,IAAI,KAAK,CAAC,4FAA4F,CAAC,CAAA;IAC/G,CAAC;IACD,MAAM,EAAE,GAAG,IAAI,WAAW,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,cAAc,EAAE,CAAC,CAAA;IAClE,MAAM,QAAQ,GAAG,MAAM,EAAE,CAAC,MAAM,CAAC,eAAe,CAAC;QAC/C,KAAK,EAAE,kBAAkB;QACzB,QAAQ,EAAE,MAAM;QAChB,MAAM,EAAE;YACN,KAAK,EAAE;gBACL;oBACE,oBAAoB,EAAE,CAAC,sBAAsB,EAAE,CAAC;iBACjD;aACF;YACD,cAAc,EAAE;gBACd,cAAc,EAAE,CAAC;aAClB;SACF;KACF,CAAC,CAAA;IACF,IAAI,QAAQ,CAAC,aAAa,IAAI,QAAQ,CAAC,aAAa,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAChE,MAAM,YAAY,GAAG,QAAQ,CAAC,aAAa,CAAC,CAAC,CAAC,CAAA;QAC9C,GAAG,CAAC,IAAI,CAAC,sBAAsB,EAAE,YAAY,CAAC,IAAI,EAAE,YAAY,CAAC,IAAI,CAAC,CAAA;QACtE,OAAO,UAAU,CAAC,SAAS,EAAE,YAAY,CAAC,IAAI,CAAC,CAAA;IACjD,CAAC;SAAM,CAAC;QACN,MAAM,IAAI,KAAK,CAAC,gFAAgF,CAAC,CAAA;IACnG,CAAC;AACH,CAAC","sourcesContent":["import convict, { addFormats, SchemaObj } from 'convict'\nimport { ipaddress, url } from 'convict-format-with-validator'\nimport { existsSync } from 'fs'\nimport os from 'os'\nimport path, { join } from 'path'\nimport json5 from 'json5'\nimport yaml from 'yaml'\nimport toml from 'toml'\n\n// eslint-disable-next-line @typescript-eslint/no-require-imports\nconst puppeteer = require('puppeteer-core')\n\nimport { downloadUrl, logger } from './utils'\nconst log = logger('webrtcperf:config')\n\nconst float = {\n name: 'float',\n coerce: (v: string) => parseFloat(v),\n validate: (v: number) => {\n if (!Number.isFinite(v)) throw new Error(`Invalid float: ${v}`)\n },\n}\n\nconst index = {\n name: 'index',\n coerce: (v: unknown) => v,\n validate: (v: boolean | string | number) => {\n if (typeof v === 'string') {\n if (v === 'true' || v === 'false' || v === '') return\n if (v.includes('-')) {\n v.split('-').forEach(n => {\n if (isNaN(parseInt(n)) || !isFinite(parseInt(n))) throw new Error(`Invalid string index: ${n}`)\n })\n return\n }\n if (v.includes(',')) {\n v.split(',').forEach(n => {\n if (isNaN(parseInt(n)) || !isFinite(parseInt(n))) throw new Error(`Invalid string index: ${n}`)\n })\n return\n }\n if (isNaN(parseInt(v)) || !isFinite(parseInt(v))) throw new Error(`Invalid string index: ${v}`)\n return\n } else if (typeof v === 'number' || typeof v === 'boolean') {\n return\n }\n throw new Error(`Invalid index: \"${v}\" (type: ${typeof v})`)\n },\n}\n\naddFormats({ ipaddress, url, float, index })\n\nconvict.addParser([\n { extension: 'json', parse: json5.parse },\n { extension: ['yml', 'yaml'], parse: yaml.parse },\n { extension: 'toml', parse: toml.parse },\n])\n\n// config schema\nconst configSchema = convict({\n url: {\n doc: `The page url to load.`,\n format: String,\n default: '',\n nullable: true,\n env: 'URL',\n arg: 'url',\n },\n urlQuery: {\n doc: `The query string to append to the page url; the following template \\\nvariables are replaced: \\`$p\\` the process pid, \\`$s\\` the session index, \\\n\\`$S\\` the total sessions, \\`$t\\` the tab index, \\`$T\\` the total tabs per \\\nsession, \\`$i\\` the tab absolute index.`,\n format: String,\n default: '',\n nullable: true,\n env: 'URL_QUERY',\n arg: 'url-query',\n },\n customUrlHandler: {\n doc: `This argument specifies the file path for the custom page URL handler that will be exported by default. \\\nThe custom page URL handler allows you to define custom URLs that can be used to open your application. \\\nThe handler function will be called with the following variables: \\\n- sessions: the total number of sessions; \\\n- tabsPerSession: the total number of tabs per session; \\\n- id: the session global index (0-indexed); \\\n- index: the tab global index (0-indexed); \\\n- tabIndex: the tab index in the current session (0-indexed); \\\n- pid: the process pid; \\\n- env: the environment variables object; \\\n- params: the script parameters object. \\\nYou can use these variables to create custom URL schemes that suit your application's needs.`,\n format: String,\n default: '',\n nullable: true,\n env: 'CUSTOM_URL_HANDLER',\n arg: 'custom-url-handler',\n },\n // fake video/audio\n videoPath: {\n doc: `The fake video path; if set, the video will be used as fake \\\nmedia source. It accepts a single path or a comma-separated list of videos \\\npaths that will be used in round-robin by the started sessions. \\\nThe docker pre-built image contains a 2 minutes video sequence stored at \\\n\\`/app/video.mp4\\`. \\\nIt accepts a local file, an http endpoint or a string starting with\n\\`generate:\\` (example: \\`generate:null\\` will generate a black video with \\\nsilent audio). \\\nThe temporary files containing the raw video and audio will be stored at \\\n\\`\\${VIDEO_CACHE_PATH}/video.\\${VIDEO_FORMAT}\\` and \\\n\\`\\${VIDEO_CACHE_PATH}/audio.wav\\`.`,\n format: String,\n default: 'https://github.com/vpalmisano/webrtcperf/releases/download/videos-1.0/kt.mp4',\n env: 'VIDEO_PATH',\n arg: 'video-path',\n },\n videoWidth: {\n doc: `The fake video resize width.`,\n format: 'nat',\n default: 1280,\n env: 'VIDEO_WIDTH',\n arg: 'video-width',\n },\n videoHeight: {\n doc: `The fake video resize height.`,\n format: 'nat',\n default: 720,\n env: 'VIDEO_HEIGHT',\n arg: 'video-height',\n },\n videoFramerate: {\n doc: `The fake video framerate.`,\n format: 'nat',\n default: 25,\n env: 'VIDEO_FRAMERATE',\n arg: 'video-framerate',\n },\n videoSeek: {\n doc: `The fake audio/video seek position in seconds.`,\n format: 'nat',\n default: 0,\n env: 'VIDEO_SEEK',\n arg: 'video-seek',\n },\n videoDuration: {\n doc: `The fake audio/video duration in seconds.`,\n format: 'nat',\n default: 120,\n env: 'VIDEO_DURATION',\n arg: 'video-duration',\n },\n videoCacheRaw: {\n doc: `If the temporary video and audio raw files can be reused across \\\nmultiple runs.`,\n format: 'Boolean',\n default: true,\n env: 'VIDEO_CACHE_RAW',\n arg: 'video-cache-raw',\n },\n videoCachePath: {\n doc: `The path where the video and audio raw files are stored.`,\n format: String,\n default: join(os.homedir(), '.webrtcperf/cache'),\n env: 'VIDEO_CACHE_PATH',\n arg: 'video-cache-path',\n },\n videoFormat: {\n doc: `The fake video file format presented to the browser.`,\n format: ['y4m', 'mjpeg'],\n default: 'y4m',\n env: 'VIDEO_FORMAT',\n arg: 'video-format',\n },\n useFakeMedia: {\n doc: `If true, the audio/video/screenshare will be generated using the browser fake device.\nOtherwise, the audio and video streams will be captured from a video element attached to the page, \nwhile the screenshare will be captured from a new browser tab.`,\n format: 'Boolean',\n default: true,\n env: 'USE_FAKE_MEDIA',\n arg: 'use-fake-media',\n },\n //\n runDuration: {\n doc: `If greater than 0, the test will stop after the provided number of \\\nseconds.`,\n format: 'nat',\n default: 0,\n env: 'RUN_DURATION',\n arg: 'run-duration',\n },\n throttleConfig: {\n doc: `A JSON5 string with a valid throttler configuration (https://github.com/vpalmisano/throttler). \\\nExample: \\\n\n \\`\\`\\`javascript\n [{\n sessions: '0-1',\n device: 'eth0',\n protocol: 'udp',\n skipSourcePorts: \"443\",\n skipDestinationPorts: \"443\",\n filter: \"--sports 443 --dports 443\",\n match: 'nbyte(\"ababa\" at 12 layer 1)',\n capture: 'capture.pcap',\n up: {\n rate: 1000,\n delay: 50,\n loss: 5,\n queue: 10,\n },\n down: [\n { rate: 2000, delay: 50, delayJitter: 10, delayJitterCorrelation: 25, loss: 2, lossBurst: 2, queue: 20 },\n { rate: 1000, delay: 50, loss: 2, queue: 20, at: 60 },\n ]\n }]\n \\`\\`\\`\n- The sessions field represents the sessions IDs range that will be affected by the rule, e.g.: \"0-10\", \"2,4\" or simply \"2\".\n- The device, protocol, up, down fields are optional. When device is not set, the default route device will be used. If protocol is specified ('udp' or 'tcp'), \\\nonly the packets with the specified protocol will be affected by the shaping rules.\n- The capture field is optional and specifies the pcap file to save the captured packets.\n- With skipSourcePorts and skipDestinationPorts you can specify a comma-separated list of ports that will not be affected by the shaping rules.\n- The filter field is optional and specifies the additional IPTables filter to apply for filtering the packets.\n- The match field is optional and specifies the additional match rule to apply for filtering the packets (https://man7.org/linux/man-pages/man8/tc-ematch.8.html).\n- The up and down fields are optional and they specify the upstream and downstream shaping rules. The possible options for the up and down rules could be:\n - rate: the shaping rate in Kbps;\n - delay: the shaping delay in milliseconds;\n - delayJitter: the shaping delay jitter in milliseconds;\n - delayJitterCorrelation: the shaping delay jitter correlation in milliseconds;\n - loss: the packet loss percentage;\n - lossBurst: the packet loss burst percentage;\n - queue: the shaping queue size in packets;\n - at: the time in seconds when the shaping rule will be applied (default: 0).\nThe up and down rules can be specified as a single object or an array of objects.\nWhen using an array of objects, specify a different \"at\" value for each of them, in order to apply a sequence of actions; please note that only the specified properties will override previous ones, so you can omit the values that you don't want to change. \\\n \\\n `,\n format: String,\n nullable: true,\n default: '',\n env: 'THROTTLE_CONFIG',\n arg: 'throttle-config',\n },\n randomAudioPeriod: {\n doc: `If not zero, it specifies the maximum period in seconds after which \\\na new random active session is selected, enabling the getUserMedia audio tracks in \\\nthat session and disabling all of the others.`,\n format: 'nat',\n default: 0,\n env: 'RANDOM_AUDIO_PERIOD',\n arg: 'random-audio-period',\n },\n randomAudioProbability: {\n doc: `When using random audio period, it defines the probability % that \\\nthe selected audio will be activated (value: 0-100).`,\n format: 'nat',\n default: 100,\n env: 'RANDOM_AUDIO_PROBABILITY',\n arg: 'random-audio-probability',\n },\n randomAudioRange: {\n doc: `When using random audio period, it defines the session indexes \\\nto be included into the random selection (default: include all the sessions).`,\n format: 'index',\n default: 'true',\n nullable: true,\n env: 'RANDOM_AUDIO_RANGE',\n arg: 'random-audio-range',\n },\n // Session config\n chromiumPath: {\n doc: `The Chromium executable path.`,\n format: String,\n nullable: true,\n default: '',\n env: 'CHROMIUM_PATH',\n arg: 'chromium-path',\n },\n chromiumVersion: {\n doc: `The Chromium version. It will be downloaded if the chromium \\\npath is not provided.`,\n format: String,\n nullable: false,\n default: puppeteer.PUPPETEER_REVISIONS.chrome,\n env: 'CHROMIUM_VERSION',\n arg: 'chromium-version',\n },\n chromiumUrl: {\n doc: `The remote Chromium URL (\\`http://HOST:PORT\\`).\nIf provided, the remote instance will be used instead of running a local\nchromium process.`,\n format: String,\n default: '',\n nullable: true,\n env: 'CHROMIUM_URL',\n arg: 'chromium-url',\n },\n chromiumFieldTrials: {\n doc: `Chromium additional field trials.`,\n format: String,\n nullable: true,\n default: '',\n env: 'CHROMIUM_FIELD_TRIALS',\n arg: 'chromium-field-trials',\n },\n windowWidth: {\n doc: `The browser window width.`,\n format: 'nat',\n default: 1920,\n env: 'WINDOW_WIDTH',\n arg: 'window-width',\n },\n windowHeight: {\n doc: `The browser window height.`,\n format: 'nat',\n default: 1080,\n env: 'WINDOW_HEIGHT',\n arg: 'window-height',\n },\n deviceScaleFactor: {\n doc: `The browser device scale factor.`,\n format: 'float',\n default: 1,\n env: 'DEVICE_SCALE_FACTOR',\n arg: 'device-scale-factor',\n },\n maxVideoDecoders: {\n doc: `Specifies the maximum number of concurrent WebRTC video decoder \\\ninstances that can be created on the same host.\nIf set it will disable the received video resolution and jitter buffer stats. \\\nThis option is supported only when using the custom chromium build. \\\nThe total decoders count is stored into the virtual file \\`/dev/shm/chromium-video-decoders\\``,\n format: Number,\n default: -1,\n env: 'MAX_VIDEO_DECODERS',\n arg: 'max-video-decoders',\n },\n maxVideoDecodersRange: {\n doc: `It applies the max video decoders option to the sessions included into this list (default: include all the sessions)`,\n format: 'index',\n default: 'true',\n nullable: true,\n env: 'MAX_VIDEO_DECODERS_RANGE',\n arg: 'max-video-decoders-range',\n },\n incognito: {\n doc: `Runs the browser in incognito mode.`,\n format: 'Boolean',\n default: false,\n env: 'INCOGNITO',\n arg: 'incognito',\n },\n display: {\n doc: `If unset, the browser will run in headless mode, otherwise it will run in normal windowed mode.\nWhen running on MacOS or Windows, set it to any not-empty string.\nOn Linux, set it to a valid X server \\`DISPLAY\\` string (e.g. \\`:0\\`).`,\n format: String,\n default: '',\n nullable: true,\n arg: 'display',\n },\n /* audioRedForOpus: {\n doc: `Enables RED for OPUS codec (experimental).`,\n format: 'Boolean',\n default: false,\n env: 'AUDIO_RED_FOR_OPUS',\n arg: 'audio-red-for-opus',\n }, */\n sessions: {\n doc: `The number of browser sessions to start.`,\n format: 'nat',\n default: 0,\n env: 'SESSIONS',\n arg: 'sessions',\n },\n tabsPerSession: {\n doc: `The number of tabs to open in each browser session.`,\n format: 'nat',\n default: 1,\n env: 'TABS_PER_SESSION',\n arg: 'tabs-per-session',\n },\n startSessionId: {\n doc: `The starting ID assigned to sessions.`,\n format: 'nat',\n default: 0,\n env: 'START_SESSION_ID',\n arg: 'start-session-id',\n },\n startTimestamp: {\n doc: `The start timestamp (in milliseconds). If 0, the value will be \\\ncalculated using \\`Date.now()\\``,\n format: 'nat',\n default: 0,\n env: 'START_TIMESTAMP',\n arg: 'start-timestamp',\n },\n enableDetailedStats: {\n doc: `If detailed participant metrics values should be collected.`,\n format: 'index',\n default: '0-24',\n nullable: true,\n env: 'ENABLE_DETAILED_STATS',\n arg: 'enable-detailed-stats',\n },\n spawnRate: {\n doc: `The pages spawn rate (pages/s).`,\n format: 'float',\n default: 1,\n env: 'SPAWN_RATE',\n arg: 'spawn-rate',\n },\n showPageLog: {\n doc: `If \\`true\\`, the pages console logs will be shown on console. Set to false to disable the page logs.`,\n format: 'Boolean',\n default: true,\n env: 'SHOW_PAGE_LOG',\n arg: 'show-page-log',\n },\n pageLogFilter: {\n doc: `If set, only the logs with the matching text will be printed \\\non the console. Regexp string allowed.`,\n format: String,\n default: '',\n nullable: true,\n env: 'PAGE_LOG_FILTER',\n arg: 'page-log-filter',\n },\n pageLogPath: {\n doc: `If set, the page console logs will be saved on the selected file path.`,\n format: String,\n default: '',\n nullable: true,\n env: 'PAGE_LOG_PATH',\n arg: 'page-log-path',\n },\n enableBrowserLogging: {\n doc: `It enables the Chromium browser logging for the specified session indexes. It requires the page log path option to be set. `,\n format: 'index',\n nullable: true,\n default: '',\n env: 'ENABLE_BROWSER_LOGGING',\n arg: 'enable-browser-logging',\n },\n userAgent: {\n doc: `The user agent override.`,\n format: String,\n default: 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36',\n nullable: true,\n env: 'USER_AGENT',\n arg: 'user-agent',\n },\n scriptPath: {\n doc: `One or more JavaScript file paths (comma-separated). \\\nIf set, the files contents will be executed inside each opened tab page; \\\nthe following global variables will be attached to the \\`webrtcperf\\` global object: \\\n\\`WEBRTC_PERF_SESSION\\` the session number (0-indexed); \\\n\\`WEBRTC_PERF_TAB\\` the tab number inside the same session (0-indexed); \\\n\\`WEBRTC_PERF_INDEX\\` the page absolute index (0-indexed). \\\n`,\n format: String,\n default: '',\n env: 'SCRIPT_PATH',\n arg: 'script-path',\n },\n scriptParams: {\n doc: `Additional parameters (in JSON format) that will be exposed into\nthe page context as \\`webrtcperf.params\\`.`,\n format: String,\n nullable: true,\n default: '',\n env: 'SCRIPT_PARAMS',\n arg: 'script-params',\n },\n disabledVideoCodecs: {\n doc: `A string with the video codecs to disable (comma-separated); e.g. \\`vp9,av1\\``,\n format: String,\n nullable: true,\n default: '',\n env: 'DISABLED_VIDEO_CODECS',\n arg: 'disabled-video-codecs',\n },\n localStorage: {\n doc: `A JSON string with the \\`localStorage\\` object to be set on page \\\nload.`,\n format: String,\n nullable: true,\n default: '',\n env: 'LOCAL_STORAGE',\n arg: 'local-storage',\n },\n sessionStorage: {\n doc: `A JSON string with the \\`sessionStorage\\` object to be set on page \\\nload.`,\n format: String,\n nullable: true,\n default: '',\n env: 'SESSION_STORAGE',\n arg: 'session-storage',\n },\n clearCookies: {\n doc: `If true, all the page cookies are cleared.`,\n format: 'Boolean',\n default: false,\n env: 'CLEAR_COOKIES',\n arg: 'clear-cookies',\n },\n enableGpu: {\n doc: `It enables the GPU acceleration (experimental). Set to \"desktop\" to \\\nuse the host X server instance.`,\n format: String,\n nullable: true,\n default: '',\n env: 'ENABLE_GPU',\n arg: 'enable-gpu',\n },\n blockedUrls: {\n doc: `A comma-separated list of request URLs that will be automatically \\\nblocked.`,\n format: String,\n nullable: true,\n default: '',\n env: 'BLOCKED_URLS',\n arg: 'blocked-urls',\n },\n extraHeaders: {\n doc: `A dictionary of headers keyed by the url in JSON5 format (e.g. \\\n\\`{ \"https://url.com/*\": { \"header-name\": \"value\" } }\\`).`,\n format: String,\n nullable: true,\n default: '',\n env: 'EXTRA_HEADERS',\n arg: 'extra-headers',\n },\n responseModifiers: {\n doc: `A dictionary of content replacements keyed by the url in JSON5 format.\nExamples:\n- replace strings using a regular expression:\n \\`{ \"https://url.com/*\": [{ search: \"searchString\": replace: \"anotherString\" }] }\\`\n- completely replace the content:\n \\`{ \"https://url.com/file.js\": [{ file: \"path/to/newFile.js\" }] }\\`\n`,\n format: String,\n nullable: true,\n default: '',\n env: 'RESPONSE_MODIFIERS',\n arg: 'response-modifiers',\n },\n downloadResponses: {\n doc: `An array of url responses that will be saved to the disk, keyed by the url in JSON5 format.\nExample: \\`[{ urlPattern: \"https://url.com/*\", output: \"save/directory\" }]\\`\n`,\n format: String,\n nullable: true,\n default: '',\n env: 'DOWNLOAD_RESPONSES',\n arg: 'download-responses',\n },\n extraCSS: {\n doc: `A string with a CSS styles to inject into each page. \\\nRules containing \"important\" will be replaced with \"!important\".`,\n format: String,\n nullable: true,\n default: '',\n env: 'EXTRA_CSS',\n arg: 'extra-css',\n },\n cookies: {\n doc: `A string with an array of [CookieParam](https://pptr.dev/api/puppeteer.cookieparam) to set into each page in JSON5 format.`,\n format: String,\n nullable: true,\n default: '',\n env: 'COOKIES',\n arg: 'cookies',\n },\n overridePermissions: {\n doc: `A comma-separated list of permissions to grant to the opened url.`,\n format: String,\n nullable: true,\n default: '',\n env: 'OVERRIDE_PERMISSIONS',\n arg: 'override-permissions',\n },\n hardwareConcurrency: {\n doc: `When set, it overrides the navigator.hardwareConcurrency property.`,\n format: 'nat',\n default: 0,\n env: 'HARDWARE_CONCURRENCY',\n arg: 'hardware-concurrency',\n },\n debuggingPort: {\n doc: `The chrome debugging port. If this value != 0, the chrome instance \\\nwill listen on the provided port + the start-session-id value.`,\n format: 'nat',\n default: 0,\n env: 'DEBUGGING_PORT',\n arg: 'debugging-port',\n },\n debuggingAddress: {\n doc: `The chrome debugging listening address. If unset, the network default interface address will be used.`,\n format: String,\n nullable: true,\n default: '127.0.0.1',\n env: 'DEBUGGING_ADDRESS',\n arg: 'debugging-address',\n },\n emulateCpuThrottling: {\n doc: `The emulated CPU throttling factor. If set, the page will be throttled to the specified factor.`,\n format: 'nat',\n default: 0,\n env: 'EMULATE_CPU_THROTTLING',\n arg: 'emulate-cpu-throttling',\n },\n // stats config\n showStats: {\n doc: `If the statistics should be displayed on the console output.`,\n format: 'Boolean',\n default: true,\n env: 'SHOW_STATS',\n arg: 'show-stats',\n },\n statsPath: {\n doc: `The log file path; if set, the stats will be written in \\\na .csv file inside that file.`,\n format: String,\n default: '',\n env: 'STATS_PATH',\n arg: 'stats-path',\n },\n detailedStatsPath: {\n doc: `The log file path; if set, the detailed stats will be written in \\\na .csv file inside that file.`,\n format: String,\n default: '',\n env: 'DETAILED_STATS_PATH',\n arg: 'detailed-stats-path',\n },\n statsInterval: {\n doc: `The stats collect interval in seconds. It should be lower than the \\\nPrometheus scraping interval.`,\n format: 'nat',\n default: 15,\n env: 'STATS_INTERVAL',\n arg: 'stats-interval',\n },\n rtcStatsTimeout: {\n doc: `The timeout in seconds after which the RTC stats coming from inactive\\\n hosts are removed. It should be higher than the \\`statsInterval\\` value.`,\n format: 'nat',\n default: 60,\n env: 'RTC_STATS_TIMEOUT',\n arg: 'rtc-stats-timeout',\n },\n customMetrics: {\n doc: `A dictionary of custom metrics keys in JSON5 format (e.g. \\\n'{ statName1: { labels: [\"label1\"] } }').`,\n format: String,\n nullable: true,\n default: '',\n env: 'CUSTOM_METRICS',\n arg: 'custom-metrics',\n },\n //\n prometheusPushgateway: {\n doc: `If set, logs are sent to the specified Prometheus Pushgateway \\\nservice (example: \"http://127.0.0.1:9091\").`,\n format: 'String',\n default: '',\n nullable: true,\n env: 'PROMETHEUS_PUSHGATEWAY',\n arg: 'prometheus-pushgateway',\n },\n prometheusPushgatewayJobName: {\n doc: `The Prometheus Pushgateway job name.`,\n format: 'String',\n default: 'default',\n env: 'PROMETHEUS_PUSHGATEWAY_JOB_NAME',\n arg: 'prometheus-pushgateway-job-name',\n },\n prometheusPushgatewayAuth: {\n doc: `The Prometheus Pushgateway basic auth (username:password).`,\n format: 'String',\n default: '',\n nullable: true,\n env: 'PROMETHEUS_PUSHGATEWAY_AUTH',\n arg: 'prometheus-pushgateway-auth',\n },\n prometheusPushgatewayGzip: {\n doc: `Allows to use gzip encoded pushgateway requests.`,\n format: 'Boolean',\n default: true,\n env: 'PROMETHEUS_PUSHGATEWAY_GZIP',\n arg: 'prometheus-pushgateway-gzip',\n },\n //\n alertRules: {\n doc: `Alert rules definition (in JSON format).`,\n format: String,\n nullable: true,\n default: '',\n env: 'ALERT_RULES',\n arg: 'alert-rules',\n },\n alertRulesOutput: {\n doc: `The alert rules report output filename. If the file ends with .log extension, a detailed log will be generated, otherwise a JSON report will be generated.`,\n format: String,\n nullable: true,\n default: '',\n env: 'ALERT_RULES_OUTPUT',\n arg: 'alert-rules-output',\n },\n alertRulesFailPercentile: {\n doc: `The alert rules report fails percentile (0-100). With the default value the \\\nalert will be successful only when at least 95% of the checks pass.`,\n format: 'nat',\n nullable: false,\n default: 95,\n env: 'ALERT_RULES_FAIL_PERCENTILE',\n arg: 'alert-rules-fail-percentile',\n },\n pushStatsUrl: {\n doc: `The URL to push the collected stats.`,\n format: String,\n nullable: true,\n default: '',\n env: 'PUSH_STATS_URL',\n arg: 'push-stats-url',\n },\n pushStatsId: {\n doc: `The ID of the collected stats to push.`,\n format: String,\n nullable: true,\n default: 'default',\n env: 'PUSH_STATS_ID',\n arg: 'push-stats-id',\n },\n // server config\n serverPort: {\n doc: `The HTTP server listening port.`,\n format: 'nat',\n nullable: true,\n default: 0,\n env: 'SERVER_PORT',\n arg: 'server-port',\n },\n serverSecret: {\n doc: `The HTTP server basic auth secret. The auth user name is set to \\`admin\\` by default.`,\n format: String,\n default: 'secret',\n env: 'SERVER_SECRET',\n arg: 'server-secret',\n },\n serverUseHttps: {\n doc: `If true, the server will use the HTTPS protocol.`,\n format: 'Boolean',\n default: false,\n env: 'SERVER_USE_HTTPS',\n arg: 'server-use-https',\n },\n serverData: {\n doc: `An optional path that the HTTP server will expose with the /data endpoint.`,\n format: String,\n nullable: true,\n default: '',\n env: 'SERVER_DATA',\n arg: 'server-data',\n },\n // VMAF config\n vmafPath: {\n doc: `When set, it runs the VMAF calculator for the video files saved under the provided directory path.`,\n format: String,\n nullable: true,\n default: '',\n env: 'VMAF_PATH',\n arg: 'vmaf-path',\n },\n vmafPreview: {\n doc: `If true, for each VMAF comparison it creates a side-by-side video with \\\nthe reference and degraded versions.`,\n format: 'Boolean',\n default: false,\n env: 'VMAF_PREVIEW',\n arg: 'vmaf-preview',\n },\n vmafKeepIntermediateFiles: {\n doc: `If true, the VMAF intermediate files will not be deleted.`,\n format: 'Boolean',\n default: false,\n env: 'VMAF_KEEP_INTERMEDIATE_FILES',\n arg: 'vmaf-keep-intermediate-files',\n },\n vmafKeepSourceFiles: {\n doc: `If true, the VMAF source files will not be deleted.`,\n format: 'Boolean',\n default: true,\n env: 'VMAF_KEEP_SOURCE_FILES',\n arg: 'vmaf-keep-source-files',\n },\n vmafSkipDuplicated: {\n doc: `If true, the VMAF will skip duplicated recognized frames.`,\n format: 'Boolean',\n default: false,\n env: 'VMAF_SKIP_DUPLICATED',\n arg: 'vmaf-skip-duplicated',\n },\n vmafCrop: {\n doc: `If set, the reference and degraded videos will be cropped using the specified configuration in JSON5 format. \\\nCrop configuration should be expressed using the ffmpeg crop filter syntax (https://ffmpeg.org/ffmpeg-filters.html#crop). \\\nE.g. \\`{ \"Participant-000001_recv-by_Participant-000000\": { ref: { w: \"iw-10\", h: \"ih-5\" }, deg: { w: \"200\", h: \"200\" } } }\\``,\n format: String,\n nullable: true,\n default: '',\n env: 'VMAF_CROP',\n arg: 'vmaf-crop',\n },\n vmafPrepareVideo: {\n doc: `When set, it prepares the selected video applying a timestamp overlay on top of it. \\\nThe filename must be provided in the format \\`<video path>,<ID>\\`, where the selected ID will be used unique video identifier in the overlay.`,\n format: String,\n nullable: true,\n default: '',\n env: 'VMAF_PREPARE_VIDEO',\n arg: 'vmaf-prepare-video',\n },\n vmafProcessVideo: {\n doc: `When set, it runs the VMAF video preprocessor, that converts a video file into the IVF format with timestamps matching the overlay recognition. \\\nThe filename must contain a \\`recv\\` or \\`send\\` string to identify if the video was a reference (send) or a degraded version (recv), e.g. \\`Participant1_recv.mp4\\`.`,\n format: String,\n nullable: true,\n default: '',\n env: 'VMAF_PROCESS_VIDEO',\n arg: 'vmaf-process-video',\n },\n vmafVideoCrop: {\n doc: `If set, the vmaf prepared/processed video will be cropped using the specified configuration in JSON5 format. \\\nCrop configuration should be expressed using the ffmpeg crop filter syntax (https://ffmpeg.org/ffmpeg-filters.html#crop). \\\nE.g. \\`{ w: \"iw-10\", h: \"ih-5\", x: \"10\", y: '5' }\\``,\n format: String,\n nullable: true,\n default: '',\n env: 'VMAF_VIDEO_CROP',\n arg: 'vmaf-video-crop',\n },\n // VISQOL config\n visqolPath: {\n doc: `When set, it runs the visqol calculator for the audio files saved under the provided directory path.`,\n format: String,\n nullable: true,\n default: '',\n env: 'VISQOL_PATH',\n arg: 'visqol-path',\n },\n visqolKeepSourceFiles: {\n doc: `If true, the visqol source files will not be deleted.`,\n format: 'Boolean',\n default: true,\n env: 'VISQOL_KEEP_SOURCE_FILES',\n arg: 'visqol-keep-source-files',\n },\n})\n\ntype ConfigDocs = Record<string, { doc: string; format: string; default: string }>\n\n/**\n * Formats the schema documentation, calling the same function recursively.\n * @param docs the documentation object to extend\n * @param property the root property\n * @param schema the config schema fragment\n * @return the documentation object\n */\nfunction formatDocs(\n docs: ConfigDocs,\n property: string | null,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n schema: any,\n): ConfigDocs {\n if (schema._cvtProperties) {\n Object.entries(schema._cvtProperties).forEach(([name, value]) => {\n formatDocs(docs, `${property ? `${property}.` : ''}${name}`, value)\n })\n return docs\n }\n\n if (property) {\n docs[property] = {\n doc: schema.doc,\n format: JSON.stringify(schema.format, null, 2),\n default: JSON.stringify(schema.default, null, 2),\n }\n }\n return docs\n}\n\n/**\n * It returns the formatted configuration docs.\n */\nexport function getConfigDocs(): ConfigDocs {\n return formatDocs({}, null, configSchema.getSchema())\n}\n\nconst _schemaProperties = configSchema.getProperties()\n\n/** [[include:config.md]] */\nexport type Config = typeof _schemaProperties\n\n/**\n * Loads the config object.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport async function loadConfig(filePath?: string, values?: any): Promise<Config> {\n if (filePath) {\n if (filePath.startsWith('http')) {\n log.debug(`Loading config from url: ${filePath}`)\n const res = await downloadUrl(filePath)\n if (!res?.data) {\n throw new Error(`Failed to download configuration from: ${filePath}`)\n }\n const values =\n res.contentType === 'application/x-yaml'\n ? yaml.parse(res.data)\n : res.contentType === 'application/toml'\n ? toml.parse(res.data)\n : json5.parse(res.data)\n configSchema.load(values)\n } else if (existsSync(filePath)) {\n log.debug(`Loading config from local file: ${filePath}`)\n if (filePath.endsWith('.js') || filePath.endsWith('.mjs')) {\n const module = await import(/* webpackIgnore: true */ path.resolve(filePath))\n configSchema.load(await module.default())\n } else {\n configSchema.loadFile(filePath)\n }\n }\n } else if (values) {\n log.debug('Loading config from values.')\n configSchema.load(values)\n } else {\n log.debug('Loading config from default values.')\n configSchema.load({})\n }\n\n configSchema.validate({ allowed: 'strict' })\n const config = configSchema.getProperties()\n\n log.debug('Using config:', config)\n return config\n}\n\nfunction getFunctionDeclaration() {\n const properties: Record<string, { type: string; description: string; nullable?: boolean }> = {}\n const required: string[] = []\n const schema = configSchema.getSchema()\n\n Object.entries(schema._cvtProperties).forEach(([name, value]) => {\n const { format, doc, nullable } = value as SchemaObj\n properties[name] = {\n type: format as string,\n description: doc as string,\n nullable,\n }\n })\n\n return {\n name: 'webrtcperf',\n description: 'Starts a webrtcperf test.',\n parameters: {\n type: 'object',\n properties,\n required,\n },\n }\n}\n\n// eslint-disable-next-line @typescript-eslint/no-require-imports\nconst { GoogleGenAI } = require('@google/genai')\n\nexport async function loadConfigFromPrompt(prompt: string) {\n log.debug(`loadConfigFromPrompt: \"${prompt}\"`)\n if (!process.env.GEMINI_API_KEY) {\n throw new Error('GEMINI_API_KEY environment variable is not set. Please set it to use the Google GenAI API.')\n }\n const ai = new GoogleGenAI({ apiKey: process.env.GEMINI_API_KEY })\n const response = await ai.models.generateContent({\n model: 'gemini-2.5-flash',\n contents: prompt,\n config: {\n tools: [\n {\n functionDeclarations: [getFunctionDeclaration()],\n },\n ],\n thinkingConfig: {\n thinkingBudget: 0,\n },\n },\n })\n if (response.functionCalls && response.functionCalls.length > 0) {\n const functionCall = response.functionCalls[0]\n log.info('Using function call:', functionCall.name, functionCall.args)\n return loadConfig(undefined, functionCall.args)\n } else {\n throw new Error('No function call found in the response. Please check the prompt and try again.')\n }\n}\n"]}
|
package/build/src/server.d.ts
CHANGED
|
@@ -131,7 +131,7 @@ export declare class Server {
|
|
|
131
131
|
/**
|
|
132
132
|
* GET /download/alert-rules endpoint.
|
|
133
133
|
*
|
|
134
|
-
* Downloads the alert rules report stored into the {@link Stats.
|
|
134
|
+
* Downloads the alert rules report stored into the {@link Stats.alertRulesOutput}.
|
|
135
135
|
*/
|
|
136
136
|
private getAlertRules;
|
|
137
137
|
/**
|