@vpalmisano/webrtcperf 4.2.0 → 4.3.2

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.
@@ -47,6 +47,7 @@ const path_1 = __importStar(require("path"));
47
47
  const json5_1 = __importDefault(require("json5"));
48
48
  const yaml_1 = __importDefault(require("yaml"));
49
49
  const toml_1 = __importDefault(require("toml"));
50
+ const fs_2 = __importDefault(require("fs"));
50
51
  // eslint-disable-next-line @typescript-eslint/no-require-imports
51
52
  const puppeteer = require('puppeteer-core');
52
53
  const utils_1 = require("./utils");
@@ -96,8 +97,7 @@ convict_1.default.addParser([
96
97
  { extension: ['yml', 'yaml'], parse: yaml_1.default.parse },
97
98
  { extension: 'toml', parse: toml_1.default.parse },
98
99
  ]);
99
- // config schema
100
- const configSchema = (0, convict_1.default)({
100
+ const configSchema = {
101
101
  url: {
102
102
  doc: `The page url to load.`,
103
103
  format: String,
@@ -453,7 +453,7 @@ calculated using \`Date.now()\``,
453
453
  showPageLog: {
454
454
  doc: `If \`true\`, the pages console logs will be shown on console. Set to false to disable the page logs.`,
455
455
  format: 'Boolean',
456
- default: true,
456
+ default: false,
457
457
  env: 'SHOW_PAGE_LOG',
458
458
  arg: 'show-page-log',
459
459
  },
@@ -485,7 +485,7 @@ on the console. Regexp string allowed.`,
485
485
  userAgent: {
486
486
  doc: `The user agent override.`,
487
487
  format: String,
488
- default: 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36',
488
+ default: `Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/${puppeteer.PUPPETEER_REVISIONS.chrome} Safari/537.36`,
489
489
  nullable: true,
490
490
  env: 'USER_AGENT',
491
491
  arg: 'user-agent',
@@ -496,7 +496,9 @@ If set, the files contents will be executed inside each opened tab page; \
496
496
  the following global variables will be attached to the \`webrtcperf\` global object: \
497
497
  \`WEBRTC_PERF_SESSION\` the session number (0-indexed); \
498
498
  \`WEBRTC_PERF_TAB\` the tab number inside the same session (0-indexed); \
499
- \`WEBRTC_PERF_INDEX\` the page absolute index (0-indexed). \
499
+ \`WEBRTC_PERF_INDEX\` the page absolute index (0-indexed).
500
+ Suggested values:
501
+ - With meet.google.com: https://raw.githubusercontent.com/vpalmisano/webrtcperf/refs/heads/devel/examples/google-meet.js
500
502
  `,
501
503
  format: String,
502
504
  default: '',
@@ -897,7 +899,7 @@ E.g. \`{ w: "iw-10", h: "ih-5", x: "10", y: '5' }\``,
897
899
  env: 'VISQOL_KEEP_SOURCE_FILES',
898
900
  arg: 'visqol-keep-source-files',
899
901
  },
900
- });
902
+ };
901
903
  /**
902
904
  * Formats the schema documentation, calling the same function recursively.
903
905
  * @param docs the documentation object to extend
@@ -927,14 +929,15 @@ schema) {
927
929
  * It returns the formatted configuration docs.
928
930
  */
929
931
  function getConfigDocs() {
930
- return formatDocs({}, null, configSchema.getSchema());
932
+ return formatDocs({}, null, (0, convict_1.default)(configSchema).getSchema());
931
933
  }
932
- const _schemaProperties = configSchema.getProperties();
934
+ const _schemaProperties = (0, convict_1.default)(configSchema).getProperties();
933
935
  /**
934
936
  * Loads the config object.
935
937
  */
936
938
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
937
939
  async function loadConfig(filePath, values) {
940
+ const configs = [];
938
941
  if (filePath) {
939
942
  if (filePath.startsWith('http')) {
940
943
  log.debug(`Loading config from url: ${filePath}`);
@@ -942,41 +945,46 @@ async function loadConfig(filePath, values) {
942
945
  if (!res?.data) {
943
946
  throw new Error(`Failed to download configuration from: ${filePath}`);
944
947
  }
945
- const values = res.contentType === 'application/x-yaml'
946
- ? yaml_1.default.parse(res.data)
947
- : res.contentType === 'application/toml'
948
- ? toml_1.default.parse(res.data)
949
- : json5_1.default.parse(res.data);
950
- configSchema.load(values);
948
+ values =
949
+ res.contentType === 'application/x-yaml'
950
+ ? yaml_1.default.parse(res.data)
951
+ : res.contentType === 'application/toml'
952
+ ? toml_1.default.parse(res.data)
953
+ : json5_1.default.parse(res.data);
951
954
  }
952
955
  else if ((0, fs_1.existsSync)(filePath)) {
953
956
  log.debug(`Loading config from local file: ${filePath}`);
954
957
  if (filePath.endsWith('.js') || filePath.endsWith('.mjs')) {
955
958
  const module = await import(/* webpackIgnore: true */ path_1.default.resolve(filePath));
956
- configSchema.load(await module.default());
959
+ values = await module.default();
957
960
  }
958
961
  else {
959
- configSchema.loadFile(filePath);
962
+ const data = String(await fs_2.default.promises.readFile(filePath));
963
+ values =
964
+ filePath.endsWith('.yml') || filePath.endsWith('.yaml')
965
+ ? yaml_1.default.parse(data)
966
+ : filePath.endsWith('.toml')
967
+ ? toml_1.default.parse(data)
968
+ : json5_1.default.parse(data);
960
969
  }
961
970
  }
962
971
  }
963
- else if (values) {
964
- log.debug('Loading config from values.');
965
- configSchema.load(values);
972
+ if (!Array.isArray(values)) {
973
+ values = [values || {}];
966
974
  }
967
- else {
968
- log.debug('Loading config from default values.');
969
- configSchema.load({});
975
+ for (const value of values) {
976
+ const schema = (0, convict_1.default)(configSchema);
977
+ schema.load(value || {});
978
+ schema.validate({ allowed: 'strict' });
979
+ configs.push(schema.getProperties());
970
980
  }
971
- configSchema.validate({ allowed: 'strict' });
972
- const config = configSchema.getProperties();
973
- log.debug('Using config:', config);
974
- return config;
981
+ log.debug('Using config:', configs);
982
+ return configs;
975
983
  }
976
984
  function getFunctionDeclaration() {
977
985
  const properties = {};
978
986
  const required = [];
979
- const schema = configSchema.getSchema();
987
+ const schema = (0, convict_1.default)(configSchema).getSchema();
980
988
  Object.entries(schema._cvtProperties).forEach(([name, value]) => {
981
989
  const { format, doc, nullable } = value;
982
990
  properties[name] = {
@@ -1019,8 +1027,8 @@ async function loadConfigFromPrompt(prompt) {
1019
1027
  });
1020
1028
  if (response.functionCalls && response.functionCalls.length > 0) {
1021
1029
  const functionCall = response.functionCalls[0];
1022
- log.info('Using function call:', functionCall.name, functionCall.args);
1023
- return loadConfig(undefined, functionCall.args);
1030
+ log.debug('Using function call:', functionCall.name, functionCall.args);
1031
+ return functionCall.args;
1024
1032
  }
1025
1033
  else {
1026
1034
  throw new Error('No function call found in the response. Please check the prompt and try again.');
@@ -1 +1 @@
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,EAAE;QACzC,IAAI,OAAO,CAAC,KAAK,QAAQ,EAAE,CAAC;YAC1B,IAAI,CAAC,KAAK,MAAM,IAAI,CAAC,KAAK,OAAO,IAAI,CAAC,KAAK,EAAE;gBAAE,OAAM;YACrD,IAAI,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;gBACpB,CAA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AAM,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"]}
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/config.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAk4BA,sCAEC;AAWD,gCA0CC;AA8BD,oDA2BC;AAl/BD,mDAAwD;AACxD,iFAA8D;AAC9D,2BAA+B;AAC/B,4CAAmB;AACnB,6CAAiC;AACjC,kDAAyB;AACzB,gDAAuB;AACvB,gDAAuB;AACvB,4CAAmB;AAEnB,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;I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,CAAC,aAAa,CAAC,CAAC,CAAC,CAAA;QAC9C,GAAG,CAAC,KAAK,CAAC,sBAAsB,EAAE,YAAY,CAAC,IAAI,EAAE,YAAY,CAAC,IAAI,CAAC,CAAA;QACvE,OAAO,YAAY,CAAC,IAAI,CAAA;IAC1B,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'\nimport fs from 'fs'\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\nconst configSchema = {\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: false,\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/${puppeteer.PUPPETEER_REVISIONS.chrome} 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).\nSuggested values:\n- With meet.google.com: https://raw.githubusercontent.com/vpalmisano/webrtcperf/refs/heads/devel/examples/google-meet.js\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, convict(configSchema).getSchema())\n}\n\nconst _schemaProperties = convict(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 const configs: 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 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 } 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 values = await module.default()\n } else {\n const data = String(await fs.promises.readFile(filePath))\n values =\n filePath.endsWith('.yml') || filePath.endsWith('.yaml')\n ? yaml.parse(data)\n : filePath.endsWith('.toml')\n ? toml.parse(data)\n : json5.parse(data)\n }\n }\n }\n if (!Array.isArray(values)) {\n values = [values || {}]\n }\n for (const value of values) {\n const schema = convict(configSchema)\n schema.load(value || {})\n schema.validate({ allowed: 'strict' })\n configs.push(schema.getProperties())\n }\n log.debug('Using config:', configs)\n return configs\n}\n\nfunction getFunctionDeclaration() {\n const properties: Record<string, { type: string; description: string; nullable?: boolean }> = {}\n const required: string[] = []\n const schema = convict(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.debug('Using function call:', functionCall.name, functionCall.args)\n return 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"]}
@@ -52,6 +52,8 @@ const basic_auth_1 = __importDefault(require("basic-auth"));
52
52
  const config_1 = require("./config");
53
53
  const session_1 = require("./session");
54
54
  const utils_1 = require("./utils");
55
+ const throttler_1 = require("@vpalmisano/throttler");
56
+ const media_1 = require("./media");
55
57
  const log = (0, utils_1.logger)('webrtcperf:server');
56
58
  /**
57
59
  * An HTTP server instance that allows to control the tool using a REST
@@ -285,7 +287,8 @@ class Server {
285
287
  async putSession(req, res, next) {
286
288
  log.debug(`PUT /session`, req.body);
287
289
  try {
288
- const id = this.stats.consumeSessionId();
290
+ const config = req.body;
291
+ const id = this.stats.consumeSessionId(config.tabsPerSession);
289
292
  await this.startLocalSession(id, req.body);
290
293
  res.json({
291
294
  message: `Session created`,
@@ -306,10 +309,10 @@ class Server {
306
309
  async putSessions(req, res, next) {
307
310
  log.debug(`PUT /sessions`, req.body);
308
311
  try {
309
- const { sessions } = req.body;
312
+ const { sessions, tabsPerSession } = req.body;
310
313
  const sessionsIds = [];
311
314
  for (let i = 0; i < sessions; i++) {
312
- const id = this.stats.sessions.size;
315
+ const id = this.stats.consumeSessionId(tabsPerSession);
313
316
  await this.startLocalSession(id, req.body);
314
317
  sessionsIds.push(id);
315
318
  }
@@ -478,12 +481,23 @@ class Server {
478
481
  * @param config The session configuration.
479
482
  */
480
483
  async startLocalSession(id, config) {
481
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
482
- const sessionConfig = (0, config_1.loadConfig)(undefined, config);
483
- const session = new session_1.Session({ ...sessionConfig, id });
484
+ const configs = await (0, config_1.loadConfig)(undefined, config);
485
+ const sessionConfig = configs[0];
486
+ const throttleIndex = (0, throttler_1.getSessionThrottleIndex)(id);
487
+ const spawnPeriod = 1000 / sessionConfig.spawnRate;
488
+ // Prepare fake video and audio.
489
+ const mediaPaths = [];
490
+ if (sessionConfig.videoPath) {
491
+ for (const videoPath of sessionConfig.videoPath.split(',')) {
492
+ const ret = await (0, media_1.prepareFakeMedia)({ ...sessionConfig, videoPath });
493
+ mediaPaths.push(ret);
494
+ }
495
+ }
496
+ const mediaPath = mediaPaths.length ? mediaPaths[id % mediaPaths.length] : undefined;
497
+ const session = new session_1.Session({ ...sessionConfig, throttleIndex, spawnPeriod, mediaPath, id });
484
498
  session.once('stop', () => {
485
499
  console.warn(`Session ${id} stopped, reloading...`);
486
- setTimeout(this.startLocalSession.bind(this), sessionConfig.spawnPeriod, id, config);
500
+ setTimeout(this.startLocalSession.bind(this), spawnPeriod, id, config);
487
501
  });
488
502
  this.stats.addSession(session);
489
503
  try {
@@ -516,10 +530,14 @@ class Server {
516
530
  log.debug('start');
517
531
  if (this.serverUseHttps) {
518
532
  const destDir = path_1.default.join(os_1.default.homedir(), '.webrtcperf/ssl');
519
- await (0, utils_1.runShellCommand)(`mkdir -p ${destDir} && openssl req -newkey rsa:2048 -nodes -keyout ${destDir}/domain.key -x509 -days 365 -out ${destDir}/domain.crt -subj "/C=EU/ST=London/L=London/O=Global Security/OU=IT Department/CN=example.com"`);
533
+ const keyPath = path_1.default.join(destDir, 'domain.key');
534
+ const crtPath = path_1.default.join(destDir, 'domain.crt');
535
+ if (!fs_1.default.existsSync(keyPath) || !fs_1.default.existsSync(crtPath)) {
536
+ await (0, utils_1.runShellCommand)(`mkdir -p ${destDir} && openssl req -newkey rsa:2048 -nodes -keyout ${keyPath} -x509 -days 365 -out ${crtPath} -subj "/C=EU/ST=London/L=London/O=Global Security/OU=IT Department/CN=example.com"`);
537
+ }
520
538
  this.server = (0, https_1.createServer)({
521
- key: fs_1.default.readFileSync(`${destDir}/domain.key`),
522
- cert: fs_1.default.readFileSync(`${destDir}/domain.crt`),
539
+ key: fs_1.default.readFileSync(keyPath),
540
+ cert: fs_1.default.readFileSync(crtPath),
523
541
  }, this.app);
524
542
  }
525
543
  else {