@vpalmisano/webrtcperf 4.4.1 → 4.4.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.
@@ -23,6 +23,7 @@ declare const _schemaProperties: {
23
23
  useFakeMedia: boolean;
24
24
  runDuration: number;
25
25
  throttleConfig: string;
26
+ useBrowserThrottling: boolean;
26
27
  randomAudioPeriod: number;
27
28
  randomAudioProbability: number;
28
29
  randomAudioRange: string;
@@ -281,6 +281,13 @@ When using an array of objects, specify a different "at" value for each of them,
281
281
  env: 'THROTTLE_CONFIG',
282
282
  arg: 'throttle-config',
283
283
  },
284
+ useBrowserThrottling: {
285
+ doc: `If true, the network will be throttled using the browser internal throttling mechanism.`,
286
+ format: 'Boolean',
287
+ default: false,
288
+ env: 'USE_BROWSER_THROTTLING',
289
+ arg: 'use-browser-throttling',
290
+ },
284
291
  randomAudioPeriod: {
285
292
  doc: `If not zero, it specifies the maximum period in seconds after which \
286
293
  a new random active session is selected, enabling the getUserMedia audio tracks in \
@@ -1 +1 @@
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,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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,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"]}
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/config.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAy4BA,sCAEC;AAWD,gCA0CC;AA8BD,oDA2BC;AAz/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;IACZ,IAAI,EAAE,OAAO;IACb,MAAM,EAA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F,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,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 useBrowserThrottling: {\n doc: `If true, the network will be throttled using the browser internal throttling mechanism.`,\n format: 'Boolean',\n default: false,\n env: 'USE_BROWSER_THROTTLING',\n arg: 'use-browser-throttling',\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"]}
@@ -85,7 +85,7 @@ async function runWithDocker(argv) {
85
85
  };
86
86
  try {
87
87
  if (!process.env.DEBUG_SRC) {
88
- log.info('Pulling latest development image...');
88
+ log.info('Pulling latest webrtcperf image...');
89
89
  await docker.pull('ghcr.io/vpalmisano/webrtcperf:devel');
90
90
  }
91
91
  try {
@@ -1 +1 @@
1
- {"version":3,"file":"docker.js","sourceRoot":"","sources":["../../src/docker.ts"],"names":[],"mappings":";;;;;AAQA,sCA0HC;AAlID,gDAAuB;AACvB,0DAA8B;AAC9B,mCAAoD;AACpD,qCAAqC;AACrC,4CAAmB;AAEnB,MAAM,GAAG,GAAG,IAAA,cAAM,EAAC,mBAAmB,CAAC,CAAA;AAEhC,KAAK,UAAU,aAAa,CAAC,IAAc;IAChD,MAAM,MAAM,GAAG,IAAI,mBAAM,EAAE,CAAA;IAC3B,MAAM,UAAU,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,UAAU,CAAC,CAAC,CAAC,CAAC,CAAA;IACxD,IAAI,CAAC,UAAU;QAAE,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAA;IACnE,MAAM,UAAU,GAAG,cAAI,CAAC,QA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E;gBAC1D,IAAI,GAAG;oBAAE,GAAG,CAAC,KAAK,CAAC,8BAA8B,EAAE,IAAI,EAAE,GAAG,CAAC,KAAK,CAAC,CAAA;gBACnE,OAAO,CAAC,IAAI,CAAC,CAAA;YACf,CAAC,CAAC,CAAA;QACJ,CAAC,CAAC,CAAA;QAEF,MAAM,SAAS,CAAC,MAAM,EAAE,CAAA;IAC1B,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,GAAG,CAAC,KAAK,CAAC,0BAA0B,EAAE,KAAK,CAAC,CAAA;QAC5C,MAAM,KAAK,CAAA;IACb,CAAC;AACH,CAAC","sourcesContent":["import path from 'path'\nimport Docker from 'dockerode'\nimport { logger, resolvePackagePath } from './utils'\nimport { loadConfig } from './config'\nimport fs from 'fs'\n\nconst log = logger('webrtcperf:docker')\n\nexport async function runWithDocker(argv: string[]) {\n const docker = new Docker()\n const configPath = argv.filter(s => s !== '--docker')[0]\n if (!configPath) throw new Error('No configuration file specified')\n const configName = path.basename(configPath)\n const config = (await loadConfig(configPath))[0]\n\n const startTimestamp = Date.now()\n const dataDir = path.resolve(path.dirname(configPath), 'logs', `${startTimestamp}`)\n await fs.promises.mkdir(dataDir, { recursive: true })\n\n const binds: string[] = [\n `${path.resolve(configPath)}:/config/${configName}:ro`,\n '/dev/shm:/dev/shm',\n `${dataDir}:/data`,\n '/tmp/webrtcperf-cache:/root/.webrtcperf',\n ]\n\n if (config.scriptPath) {\n const scriptName = path.basename(config.scriptPath)\n binds.push(`${path.resolve(config.scriptPath)}:/scripts/${scriptName}:ro`)\n }\n\n if (process.env.DEBUG_SRC) {\n binds.push(`${resolvePackagePath('app.min.js')}:/app/app.min.js:ro`)\n }\n\n const portBindings: Docker.PortMap = {}\n const exposedPorts: { [portAndProtocol: string]: object } = {}\n if (config.debuggingPort) {\n for (let i = 0; i < config.sessions; i++) {\n const port = `${config.debuggingPort + i}/tcp`\n portBindings[port] = [{ HostPort: `${config.debuggingPort + i}` }]\n exposedPorts[port] = {}\n }\n }\n\n const env = [\n `DEBUG_LEVEL=${process.env.DEBUG_LEVEL || 'info'}`,\n 'SHOW_PAGE_LOG=false',\n 'SHOW_STATS=false',\n 'SERVER_PORT=5000',\n 'SERVER_USE_HTTPS=true',\n 'SERVER_DATA=/data',\n `START_TIMESTAMP=${startTimestamp}`,\n `STATS_PATH=/data/stats.csv`,\n `PAGE_LOG_PATH=/data/page.log`,\n `DETAILED_STATS_PATH=/data/detailed-stats.csv`,\n ]\n\n if (config.scriptPath) {\n const scriptName = path.basename(config.scriptPath)\n env.push(`SCRIPT_PATH=/scripts/${scriptName}`)\n }\n\n if (config.debuggingPort) {\n env.push(`DEBUGGING_PORT=${config.debuggingPort}`)\n }\n\n if (config.prometheusPushgateway.startsWith('http://localhost')) {\n env.push('PROMETHEUS_PUSHGATEWAY=http://pushgateway:9091')\n }\n\n const containerConfig: Docker.ContainerCreateOptions = {\n Image: 'ghcr.io/vpalmisano/webrtcperf:devel',\n name: 'webrtcperf',\n Cmd: [`/config/${configName}`],\n HostConfig: {\n Binds: binds,\n PortBindings: portBindings,\n CapAdd: ['NET_ADMIN'],\n NetworkMode: config.prometheusPushgateway.startsWith('http://localhost') ? 'prometheus-stack_default' : 'bridge',\n },\n Env: env,\n AttachStdin: true,\n AttachStdout: true,\n AttachStderr: true,\n Tty: true,\n OpenStdin: true,\n StdinOnce: true,\n ExposedPorts: exposedPorts,\n }\n\n try {\n if (!process.env.DEBUG_SRC) {\n log.info('Pulling latest development image...')\n await docker.pull('ghcr.io/vpalmisano/webrtcperf:devel')\n }\n\n try {\n const existingContainer = await docker.getContainer('webrtcperf')\n await existingContainer.remove({ force: true })\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n } catch (err: unknown) {\n // Container doesn't exist, continue\n }\n\n const container = await docker.createContainer(containerConfig)\n await container.start()\n\n const stream = await container.attach({\n stream: true,\n stdin: true,\n stdout: true,\n stderr: true,\n })\n\n process.stdin.pipe(stream)\n stream.pipe(process.stdout)\n\n await new Promise(resolve => {\n container.wait((err: Error, data: { StatusCode: number }) => {\n if (err) log.error('Error waiting for container:', data, err.stack)\n resolve(data)\n })\n })\n\n await container.remove()\n } catch (error) {\n log.error('Docker operation failed:', error)\n throw error\n }\n}\n"]}
1
+ {"version":3,"file":"docker.js","sourceRoot":"","sources":["../../src/docker.ts"],"names":[],"mappings":";;;;;AAQA,sCA0HC;AAlID,gDAAuB;AACvB,0DAA8B;AAC9B,mCAAoD;AACpD,qCAAqC;AACrC,4CAAmB;AAEnB,MAAM,GAAG,GAAG,IAAA,cAAM,EAAC,mBAAmB,CAAC,CAAA;AAEhC,KAAK,UAAU,aAAa,CAAC,IAAc;IAChD,MAAM,MAAM,GAAG,IAAI,mBAAM,EAAE,CAAA;IAC3B,MAAM,UAAU,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,UAAU,CAAC,CAAC,CAAC,CAAC,CAAA;IACxD,IAAI,CAAC,UAAU;QAAE,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAA;IACnE,MAAM,UAAU,GAAG,cAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAA;IAC5C,MAAM,MAAM,GAAG,CAAC,MAAM,IAAA,mBAAU,EAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;IAEhD,MAAM,cAAc,GAAG,IAAI,CAAC,GAAG,EAAE,CAAA;IACjC,MAAM,OAAO,GAAG,cAAI,CAAC,OAAO,CAAC,cAAI,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,MAAM,EAAE,GAAG,cAAc,EAAE,CAAC,CAAA;IACnF,MAAM,YAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAA;IAErD,MAAM,KAAK,GAAa;QACtB,GAAG,cAAI,CAAC,OAAO,CAAC,UAAU,CAAC,YAAY,UAAU,KAAK;QACtD,mBAAmB;QACnB,GAAG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,CAAC,CAAA;YACjE,MAAM,iBAAiB,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAA;YAC/C,6DAA6D;QAC/D,CAAC;QAAC,OAAO,GAAY,EAAE,CAAC;YACtB,oCAAoC;QACtC,CAAC;QAED,MAAM,SAAS,GAAG,MAAM,MAAM,CAAC,eAAe,CAAC,eAAe,CAAC,CAAA;QAC/D,MAAM,SAAS,CAAC,KAAK,EAAE,CAAA;QAEvB,MAAM,MAAM,GAAG,MAAM,SAAS,CAAC,MAAM,CAAC;YACpC,MAAM,EAAE,IAAI;YACZ,KAAK,EAAE,IAAI;YACX,MAAM,EAAE,IAAI;YACZ,MAAM,EAAE,IAAI;SACb,CAAC,CAAA;QAEF,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;QAC1B,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;QAE3B,MAAM,IAAI,OAAO,CAAC,OAAO,CAAC,EAAE;YAC1B,SAAS,CAAC,IAAI,CAAC,CAAC,GAAU,EAAE,IAA4B,EAAE,EAAE;gBAC1D,IAAI,GAAG;oBAAE,GAAG,CAAC,KAAK,CAAC,8BAA8B,EAAE,IAAI,EAAE,GAAG,CAAC,KAAK,CAAC,CAAA;gBACnE,OAAO,CAAC,IAAI,CAAC,CAAA;YACf,CAAC,CAAC,CAAA;QACJ,CAAC,CAAC,CAAA;QAEF,MAAM,SAAS,CAAC,MAAM,EAAE,CAAA;IAC1B,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,GAAG,CAAC,KAAK,CAAC,0BAA0B,EAAE,KAAK,CAAC,CAAA;QAC5C,MAAM,KAAK,CAAA;IACb,CAAC;AACH,CAAC","sourcesContent":["import path from 'path'\nimport Docker from 'dockerode'\nimport { logger, resolvePackagePath } from './utils'\nimport { loadConfig } from './config'\nimport fs from 'fs'\n\nconst log = logger('webrtcperf:docker')\n\nexport async function runWithDocker(argv: string[]) {\n const docker = new Docker()\n const configPath = argv.filter(s => s !== '--docker')[0]\n if (!configPath) throw new Error('No configuration file specified')\n const configName = path.basename(configPath)\n const config = (await loadConfig(configPath))[0]\n\n const startTimestamp = Date.now()\n const dataDir = path.resolve(path.dirname(configPath), 'logs', `${startTimestamp}`)\n await fs.promises.mkdir(dataDir, { recursive: true })\n\n const binds: string[] = [\n `${path.resolve(configPath)}:/config/${configName}:ro`,\n '/dev/shm:/dev/shm',\n `${dataDir}:/data`,\n '/tmp/webrtcperf-cache:/root/.webrtcperf',\n ]\n\n if (config.scriptPath) {\n const scriptName = path.basename(config.scriptPath)\n binds.push(`${path.resolve(config.scriptPath)}:/scripts/${scriptName}:ro`)\n }\n\n if (process.env.DEBUG_SRC) {\n binds.push(`${resolvePackagePath('app.min.js')}:/app/app.min.js:ro`)\n }\n\n const portBindings: Docker.PortMap = {}\n const exposedPorts: { [portAndProtocol: string]: object } = {}\n if (config.debuggingPort) {\n for (let i = 0; i < config.sessions; i++) {\n const port = `${config.debuggingPort + i}/tcp`\n portBindings[port] = [{ HostPort: `${config.debuggingPort + i}` }]\n exposedPorts[port] = {}\n }\n }\n\n const env = [\n `DEBUG_LEVEL=${process.env.DEBUG_LEVEL || 'info'}`,\n 'SHOW_PAGE_LOG=false',\n 'SHOW_STATS=false',\n 'SERVER_PORT=5000',\n 'SERVER_USE_HTTPS=true',\n 'SERVER_DATA=/data',\n `START_TIMESTAMP=${startTimestamp}`,\n `STATS_PATH=/data/stats.csv`,\n `PAGE_LOG_PATH=/data/page.log`,\n `DETAILED_STATS_PATH=/data/detailed-stats.csv`,\n ]\n\n if (config.scriptPath) {\n const scriptName = path.basename(config.scriptPath)\n env.push(`SCRIPT_PATH=/scripts/${scriptName}`)\n }\n\n if (config.debuggingPort) {\n env.push(`DEBUGGING_PORT=${config.debuggingPort}`)\n }\n\n if (config.prometheusPushgateway.startsWith('http://localhost')) {\n env.push('PROMETHEUS_PUSHGATEWAY=http://pushgateway:9091')\n }\n\n const containerConfig: Docker.ContainerCreateOptions = {\n Image: 'ghcr.io/vpalmisano/webrtcperf:devel',\n name: 'webrtcperf',\n Cmd: [`/config/${configName}`],\n HostConfig: {\n Binds: binds,\n PortBindings: portBindings,\n CapAdd: ['NET_ADMIN'],\n NetworkMode: config.prometheusPushgateway.startsWith('http://localhost') ? 'prometheus-stack_default' : 'bridge',\n },\n Env: env,\n AttachStdin: true,\n AttachStdout: true,\n AttachStderr: true,\n Tty: true,\n OpenStdin: true,\n StdinOnce: true,\n ExposedPorts: exposedPorts,\n }\n\n try {\n if (!process.env.DEBUG_SRC) {\n log.info('Pulling latest webrtcperf image...')\n await docker.pull('ghcr.io/vpalmisano/webrtcperf:devel')\n }\n\n try {\n const existingContainer = await docker.getContainer('webrtcperf')\n await existingContainer.remove({ force: true })\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n } catch (err: unknown) {\n // Container doesn't exist, continue\n }\n\n const container = await docker.createContainer(containerConfig)\n await container.start()\n\n const stream = await container.attach({\n stream: true,\n stdin: true,\n stdout: true,\n stderr: true,\n })\n\n process.stdin.pipe(stream)\n stream.pipe(process.stdout)\n\n await new Promise(resolve => {\n container.wait((err: Error, data: { StatusCode: number }) => {\n if (err) log.error('Error waiting for container:', data, err.stack)\n resolve(data)\n })\n })\n\n await container.remove()\n } catch (error) {\n log.error('Docker operation failed:', error)\n throw error\n }\n}\n"]}
@@ -95,6 +95,7 @@ export interface SessionParams {
95
95
  userAgent: string;
96
96
  id: number;
97
97
  throttleIndex: number;
98
+ useBrowserThrottling: boolean;
98
99
  evaluateAfter?: any[];
99
100
  exposedFunctions?: string;
100
101
  scriptParams: string;
@@ -188,6 +189,8 @@ export declare class Session extends EventEmitter {
188
189
  readonly id: number;
189
190
  /** The throttle configuration index assigned to the session. */
190
191
  readonly throttleIndex: number;
192
+ /** If true, the network will be throttled using the browser internal throttling mechanism. */
193
+ readonly useBrowserThrottling: boolean;
191
194
  /** The test page url. */
192
195
  readonly url: string;
193
196
  /** The url query. */
@@ -243,7 +246,7 @@ export declare class Session extends EventEmitter {
243
246
  pageErrors: number;
244
247
  private screensharePage?;
245
248
  private static readonly jsonFetchCache;
246
- constructor({ chromiumUrl, chromiumPath, chromiumFieldTrials, windowWidth, windowHeight, deviceScaleFactor, display, url, urlQuery, customUrlHandler, customUrlHandlerFn, mediaPath, videoWidth, videoHeight, videoFramerate, useFakeMedia, enableGpu, enableBrowserLogging, startTimestamp, sessions, tabsPerSession, spawnPeriod, statsInterval, disabledVideoCodecs, localStorage, sessionStorage, clearCookies, scriptPath, showPageLog, pageLogFilter, pageLogPath, userAgent, id, throttleIndex, evaluateAfter, exposedFunctions, scriptParams, blockedUrls, extraHeaders, responseModifiers, downloadResponses, extraCSS, cookies, overridePermissions, hardwareConcurrency, debuggingPort, debuggingAddress, randomAudioPeriod, maxVideoDecoders, maxVideoDecodersRange, incognito, serverPort, serverSecret, serverUseHttps, emulateCpuThrottling, }: SessionParams);
249
+ constructor({ chromiumUrl, chromiumPath, chromiumFieldTrials, windowWidth, windowHeight, deviceScaleFactor, display, url, urlQuery, customUrlHandler, customUrlHandlerFn, mediaPath, videoWidth, videoHeight, videoFramerate, useFakeMedia, enableGpu, enableBrowserLogging, startTimestamp, sessions, tabsPerSession, spawnPeriod, statsInterval, disabledVideoCodecs, localStorage, sessionStorage, clearCookies, scriptPath, showPageLog, pageLogFilter, pageLogPath, userAgent, id, throttleIndex, useBrowserThrottling, evaluateAfter, exposedFunctions, scriptParams, blockedUrls, extraHeaders, responseModifiers, downloadResponses, extraCSS, cookies, overridePermissions, hardwareConcurrency, debuggingPort, debuggingAddress, randomAudioPeriod, maxVideoDecoders, maxVideoDecodersRange, incognito, serverPort, serverSecret, serverUseHttps, emulateCpuThrottling, }: SessionParams);
247
250
  /**
248
251
  * Returns the chromium browser launch args
249
252
  * @return the args list
@@ -259,6 +262,7 @@ export declare class Session extends EventEmitter {
259
262
  * @param tabIndex
260
263
  */
261
264
  openPage(tabIndex: number): Promise<void>;
265
+ private applyNetworkThrottling;
262
266
  private getNewPage;
263
267
  private onPageMessage;
264
268
  /**
@@ -99,6 +99,8 @@ class Session extends events_1.default {
99
99
  id;
100
100
  /** The throttle configuration index assigned to the session. */
101
101
  throttleIndex;
102
+ /** If true, the network will be throttled using the browser internal throttling mechanism. */
103
+ useBrowserThrottling;
102
104
  /** The test page url. */
103
105
  url;
104
106
  /** The url query. */
@@ -152,7 +154,7 @@ class Session extends events_1.default {
152
154
  });
153
155
  constructor({ chromiumUrl, chromiumPath, chromiumFieldTrials, windowWidth, windowHeight, deviceScaleFactor, display,
154
156
  /* audioRedForOpus, */
155
- url, urlQuery, customUrlHandler, customUrlHandlerFn, mediaPath, videoWidth, videoHeight, videoFramerate, useFakeMedia, enableGpu, enableBrowserLogging, startTimestamp, sessions, tabsPerSession, spawnPeriod, statsInterval, disabledVideoCodecs, localStorage, sessionStorage, clearCookies, scriptPath, showPageLog, pageLogFilter, pageLogPath, userAgent, id, throttleIndex, evaluateAfter, exposedFunctions, scriptParams, blockedUrls, extraHeaders, responseModifiers, downloadResponses, extraCSS, cookies, overridePermissions, hardwareConcurrency, debuggingPort, debuggingAddress, randomAudioPeriod, maxVideoDecoders, maxVideoDecodersRange, incognito, serverPort, serverSecret, serverUseHttps, emulateCpuThrottling, }) {
157
+ url, urlQuery, customUrlHandler, customUrlHandlerFn, mediaPath, videoWidth, videoHeight, videoFramerate, useFakeMedia, enableGpu, enableBrowserLogging, startTimestamp, sessions, tabsPerSession, spawnPeriod, statsInterval, disabledVideoCodecs, localStorage, sessionStorage, clearCookies, scriptPath, showPageLog, pageLogFilter, pageLogPath, userAgent, id, throttleIndex, useBrowserThrottling, evaluateAfter, exposedFunctions, scriptParams, blockedUrls, extraHeaders, responseModifiers, downloadResponses, extraCSS, cookies, overridePermissions, hardwareConcurrency, debuggingPort, debuggingAddress, randomAudioPeriod, maxVideoDecoders, maxVideoDecodersRange, incognito, serverPort, serverSecret, serverUseHttps, emulateCpuThrottling, }) {
156
158
  super();
157
159
  log.debug('constructor', { id });
158
160
  this.id = id;
@@ -230,6 +232,7 @@ class Session extends events_1.default {
230
232
  this.serverUseHttps = serverUseHttps;
231
233
  this.emulateCpuThrottling = emulateCpuThrottling;
232
234
  this.throttleIndex = throttleIndex;
235
+ this.useBrowserThrottling = useBrowserThrottling;
233
236
  this.evaluateAfter = evaluateAfter || [];
234
237
  this.exposedFunctions = exposedFunctions || {};
235
238
  if (scriptParams) {
@@ -601,6 +604,8 @@ webrtcperf.config.AUDIO_URL = "http${this.serverUseHttps ? 's' : ''}://localhost
601
604
  await this.context.overridePermissions(new URL(url).origin, this.overridePermissions);
602
605
  }
603
606
  const page = await this.getNewPage(tabIndex);
607
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
608
+ const pageCDPSession = page._client();
604
609
  await page.setBypassCSP(true);
605
610
  if (this.userAgent) {
606
611
  await page.setUserAgent(this.userAgent);
@@ -632,8 +637,7 @@ Object.defineProperty(window.screen.orientation, 'type', { value: 'landscape-pri
632
637
  // Clear cookies.
633
638
  if (this.clearCookies) {
634
639
  try {
635
- const client = await page.target().createCDPSession();
636
- await client.send('Network.clearBrowserCookies');
640
+ await pageCDPSession.send('Network.clearBrowserCookies');
637
641
  }
638
642
  catch (err) {
639
643
  log.error(`clearCookies error: ${err.stack}`);
@@ -671,8 +675,6 @@ Object.defineProperty(window.screen.orientation, 'type', { value: 'landscape-pri
671
675
  });
672
676
  // Enable request interception.
673
677
  let setRequestInterceptionState = true;
674
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
675
- const pageCDPSession = page._client();
676
678
  await pageCDPSession.send('Network.setBypassServiceWorker', {
677
679
  bypass: true,
678
680
  });
@@ -857,20 +859,25 @@ Object.defineProperty(window.screen.orientation, 'type', { value: 'landscape-pri
857
859
  await page.emulateCPUThrottling(this.emulateCpuThrottling);
858
860
  }
859
861
  // PeerConnectionExternal
860
- await page.exposeFunction('createPeerConnectionExternal',
861
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
862
- async (options) => {
863
- const pc = new utils_1.PeerConnectionExternal(options);
864
- return { id: pc.id };
865
- });
866
- await page.exposeFunction('callPeerConnectionExternalMethod',
867
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
868
- async (id, name, arg) => {
869
- const pc = utils_1.PeerConnectionExternal.get(id);
862
+ /* await page.exposeFunction(
863
+ 'createPeerConnectionExternal',
864
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
865
+ async (options: any) => {
866
+ const pc = new PeerConnectionExternal(options)
867
+ return { id: pc.id }
868
+ },
869
+ )
870
+
871
+ await page.exposeFunction(
872
+ 'callPeerConnectionExternalMethod',
873
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
874
+ async (id: number, name: PeerConnectionExternalMethod, arg: any) => {
875
+ const pc = PeerConnectionExternal.get(id)
870
876
  if (pc) {
871
- return pc[name](arg);
877
+ return pc[name](arg)
872
878
  }
873
- });
879
+ },
880
+ )*/
874
881
  // Simulate keypress
875
882
  await page.exposeFunction('keypressText', async (selector, text, delay = 20) => {
876
883
  await page.type(selector, text, { delay });
@@ -1072,11 +1079,23 @@ Object.defineProperty(window.screen.orientation, 'type', { value: 'landscape-pri
1072
1079
  pageCDPSession.on('Network.webSocketFrameReceived', event => {
1073
1080
  resourcesStats.wsRecvBytes += event.response.payloadData.length;
1074
1081
  });
1075
- // hardware concurrency
1082
+ // Hardware concurrency.
1076
1083
  if (this.hardwareConcurrency) {
1077
1084
  const plugin = NavigatorHardwareConcurrency({ hardwareConcurrency: this.hardwareConcurrency });
1078
1085
  await plugin.onPageCreated(page);
1079
1086
  }
1087
+ // Network throttling.
1088
+ if (this.throttleIndex > -1 && (process.platform !== 'linux' || this.useBrowserThrottling)) {
1089
+ log.debug(`Using internal network throttling`);
1090
+ await pageCDPSession.send('Network.emulateNetworkConditions', {
1091
+ offline: false,
1092
+ uploadThroughput: 100000000 / 8,
1093
+ downloadThroughput: 100000000 / 8,
1094
+ latency: 0,
1095
+ packetLoss: 0,
1096
+ packetQueueLength: 0,
1097
+ });
1098
+ }
1080
1099
  // Load page script.
1081
1100
  {
1082
1101
  const filePath = (0, utils_1.resolvePackagePath)('node_modules/@vpalmisano/webrtcperf-js/dist/webrtcperf.js');
@@ -1134,6 +1153,12 @@ Object.defineProperty(window.screen.orientation, 'type', { value: 'landscape-pri
1134
1153
  }
1135
1154
  // add to pages map
1136
1155
  this.pages.set(index, page);
1156
+ if (this.throttleIndex > -1 && (process.platform !== 'linux' || this.useBrowserThrottling)) {
1157
+ await this.applyNetworkThrottling(pageCDPSession);
1158
+ throttler_1.throttleNotifier.on('change', async () => {
1159
+ await this.applyNetworkThrottling(pageCDPSession);
1160
+ });
1161
+ }
1137
1162
  log.debug(`Page ${index + 1} "${url}" loaded in ${(Date.now() - pageLoadTime) / 1000}s`);
1138
1163
  for (let i = 0; i < this.evaluateAfter.length; i++) {
1139
1164
  await page.evaluate(
@@ -1141,6 +1166,24 @@ Object.defineProperty(window.screen.orientation, 'type', { value: 'landscape-pri
1141
1166
  this.evaluateAfter[i].pageFunction, ...this.evaluateAfter[i].args);
1142
1167
  }
1143
1168
  }
1169
+ async applyNetworkThrottling(pageCDPSession) {
1170
+ const throttleUpValues = (0, throttler_1.getSessionThrottleValues)(this.throttleIndex, 'up');
1171
+ const throttleDownValues = (0, throttler_1.getSessionThrottleValues)(this.throttleIndex, 'down');
1172
+ const params = {
1173
+ offline: false,
1174
+ uploadThroughput: throttleUpValues.rate || -1,
1175
+ downloadThroughput: throttleDownValues.rate || -1,
1176
+ latency: Math.max(throttleUpValues.delay || 0, throttleDownValues.delay || 0),
1177
+ packetLoss: Math.max(throttleUpValues.loss || 0, throttleDownValues.loss || 0),
1178
+ packetQueueLength: Math.max(throttleUpValues.queue || 0, throttleDownValues.queue || 0),
1179
+ };
1180
+ log.debug(`Apply internal network throttling: ${JSON.stringify(params)}`);
1181
+ await pageCDPSession.send('Network.emulateNetworkConditions', {
1182
+ ...params,
1183
+ uploadThroughput: params.uploadThroughput !== -1 ? params.uploadThroughput / 8 : -1,
1184
+ downloadThroughput: params.downloadThroughput !== -1 ? params.downloadThroughput / 8 : -1,
1185
+ });
1186
+ }
1144
1187
  async getNewPage(tabIndex) {
1145
1188
  log.debug(`getNewPage ${tabIndex}`);
1146
1189
  (0, assert_1.default)(this.context, 'NoBrowserContextCreated');