@vpalmisano/webrtcperf 4.5.2 → 4.6.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.
@@ -1 +1 @@
1
- {"version":3,"file":"plot.js","sourceRoot":"","sources":["../../src/plot.ts"],"names":[],"mappings":";;;;;AAiCA,gCA+DC;AAED,oBAmCC;AAED,4BA6BC;AAuBD,gEAoYC;AA/jBD,4CAAmB;AAEnB,mCAAgC;AAChC,kDAAyB;AACzB,2CAA6F;AAC7F,gDAAuB;AAEvB,MAAM,GAAG,GAAG,IAAA,cAAM,EAAC,iBAAiB,CAAC,CAAA;AAkBrC,MAAM,aAAa,GAAG;IACpB,uBAAuB;IACvB,sBAAsB;IACtB,sBAAsB;IACtB,sBAAsB;IACtB,uBAAuB;CACxB,CAAA;AAED,SAAgB,UAAU,CAAC,OAAoB,EAAE,MAAkB;IACjE,GAAG,CAAC,KAAK,CAAC,YAAY,CAAC,CAAA;IAEvB,OAAO;QACL,8DAA8D;QAC9D,IAAI,EAAE,CAAC,OAAO,CAAC,IAAI,IAAI,MAAM,CAAQ;QACrC,OAAO,EAAE;YACP,OAAO,EAAE;gBACP,KAAK,EAAE,OAAO,CAAC,KAAK;oBAClB,CAAC,CAAC;wBACE,OAAO,EAAE,IAAI;wBACb,IAAI,EAAE,OAAO,CAAC,KAAK;qBACpB;oBACH,CAAC,CAAC,SAAS;gBACb,IAAI,EAAE;oBACJ,GAAG,EAAE;wBACH,OAAO,EAAE,IAAI;wBACb,IAAI,EAAE,GAAG;wBACT,WAAW,EAAE,MAAM;qBACpB;oBACD,IAAI,EAAE;wBACJ,IAAI,EAAE;4BACJ,OAAO,EAAE,IAAI;yBACd;wBACD,IAAI,EAAE,GAAG;qBACV;iBACF;aACF;YACD,MAAM,EAAE;gBACN,CAAC,EAAE;oBACD,IAAI,EAAE,UAAU;oBAChB,KAAK,EAAE,OAAO,CAAC,MAAM;wBACnB,CAAC,CAAC;4BACE,OAAO,EAAE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esContent":["import fs from 'fs'\n\nimport { logger } from './utils'\nimport json5 from 'json5'\nimport { formatThrottleRule, parseStatsFile, parseThrottleRule, StatsRow } from './scenarios'\nimport path from 'path'\n\nconst log = logger('webrtcperf:plot')\n\nexport type PlotOptions = {\n type?: string\n title?: string\n xLabel?: string\n yLabel?: string\n yMin?: number\n yMax?: number\n labels?: (string | number)[]\n filePath?: string\n}\n\nexport type PlotData = {\n label: string\n data: { x: number | string; y: number; yMin?: number; yMax?: number }[]\n}\n\nconst SERIES_COLORS = [\n 'rgba(33, 150, 243, 1)',\n 'rgba(244, 67, 54, 1)',\n 'rgba(76, 175, 80, 1)',\n 'rgba(255, 193, 7, 1)',\n 'rgba(156, 39, 176, 1)',\n]\n\nexport function plotConfig(options: PlotOptions, series: PlotData[]) {\n log.debug('plotConfig')\n\n return {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n type: (options.type || 'line') as any,\n options: {\n plugins: {\n title: options.title\n ? {\n display: true,\n text: options.title,\n }\n : undefined,\n zoom: {\n pan: {\n enabled: true,\n mode: 'x',\n modifierKey: 'ctrl',\n },\n zoom: {\n drag: {\n enabled: true,\n },\n mode: 'x',\n },\n },\n },\n scales: {\n x: {\n type: 'category',\n title: options.xLabel\n ? {\n display: true,\n text: options.xLabel,\n }\n : undefined,\n },\n y: {\n type: 'linear',\n title: options.yLabel\n ? {\n display: true,\n text: options.yLabel,\n }\n : undefined,\n min: options.yMin,\n max: options.yMax,\n },\n },\n },\n data: {\n labels: options.labels,\n datasets: series.map((s, i) => ({\n fill: false,\n backgroundColor: SERIES_COLORS[i % SERIES_COLORS.length],\n borderColor: SERIES_COLORS[i % SERIES_COLORS.length],\n borderWidth: 1,\n pointRadius: 0,\n ...s,\n })),\n },\n }\n}\n\nexport async function plot(options: PlotOptions, series: PlotData[]) {\n const {\n CategoryScale,\n Chart,\n LinearScale,\n LineController,\n BarController,\n LineElement,\n BarElement,\n PointElement,\n Legend,\n Title,\n } = await import('chart.js')\n const { BarWithErrorBar, BarWithErrorBarsController } = await import('chartjs-chart-error-bars')\n Chart.register(\n CategoryScale,\n LineController,\n LineElement,\n BarController,\n LinearScale,\n BarElement,\n PointElement,\n Legend,\n Title,\n BarWithErrorBar,\n BarWithErrorBarsController,\n )\n const { Canvas } = await import('skia-canvas')\n\n log.debug('plot')\n const config = plotConfig(options, series)\n const canvas = new Canvas(1280, 720)\n const chart = new Chart(canvas as unknown as HTMLCanvasElement, config)\n await canvas.toFile(options.filePath || 'plot.png', { format: 'png', matte: 'white' })\n chart.destroy()\n}\n\nexport async function plotHtml(options: PlotOptions, series: PlotData[]) {\n log.debug('plotHtml')\n const config = plotConfig(options, series)\n\n const data = `\n<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n <meta charset=\"UTF-8\">\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n <title>${options.title || 'Plot'}</title>\n <script src=\"https://cdn.jsdelivr.net/npm/chart.js\"></script>\n <script src=\"https://cdn.jsdelivr.net/npm/chartjs-chart-error-bars\"></script>\n <script src=\"https://cdn.jsdelivr.net/npm/hammerjs\"></script>\n <script src=\"https://cdn.jsdelivr.net/npm/chartjs-plugin-zoom\"></script>\n</head>\n<body>\n <div>\n <canvas id=\"chart\"></canvas>\n </div>\n <script>\n const ctx = document.getElementById('chart');\n const chart = new Chart(ctx, ${json5.stringify(config)});\n chart.options.onClick = e => e.chart.resetZoom();\n addEventListener('resize', () => chart.resize());\n </script>\n</body>\n</html>`\n await fs.promises.writeFile(options.filePath || 'plot.html', data)\n}\n\nfunction groupByParticipant(rows: StatsRow[]) {\n const m = new Map<string, StatsRow[]>()\n for (const r of rows) {\n if (!r.participantName) continue\n const p = r.participantName as string\n if (!m.has(p)) m.set(p, [])\n m.get(p)!.push(r)\n }\n return m\n}\n\n/**\n * It plots a detailed stats dashboard from a CSV file.\n * @param statsFile The path to the CSV file containing the detailed stats.\n * @param outFile The path to the output HTML file.\n * @returns A promise that resolves when the plot is complete.\n * @example\n * ```bash\n * webrtcperf --plot logs/detailed-stats.csv plot.html\n * ```\n */\nexport async function plotDetailedStatsDashboard(statsFile: string, outFile = 'plot.html') {\n log.info(`Plotting detailed stats from ${statsFile} to ${outFile}`)\n\n const rows = await parseStatsFile(statsFile)\n if (rows.length === 0) {\n log.warn('No stats found')\n return\n }\n\n const byParticipant = groupByParticipant(rows)\n const participants = Array.from(byParticipant.keys()).sort()\n\n type ChartSpec = { id: string; title?: string; yLabel?: string; datasets?: PlotData[]; width?: number }\n const charts: ChartSpec[] = []\n\n const build = (\n id: string,\n title?: string,\n yLabel?: string,\n processValue?: (value: number) => number,\n width?: number,\n ) => {\n const series: PlotData[] = []\n if (!id.startsWith('_')) {\n for (const [participant, rows] of byParticipant.entries()) {\n const dataPerTrack = new Map<string, { x: number; y: number }[]>()\n for (const r of rows) {\n const trackId = (r.trackId as string) || ''\n if (!dataPerTrack.has(trackId)) dataPerTrack.set(trackId, [])\n const data = dataPerTrack.get(trackId)!\n const v = r[id] as number\n if (v !== undefined) data.push({ x: r.datetime as number, y: processValue ? processValue(v) : v })\n }\n dataPerTrack.forEach((data, trackId) => {\n if (data.length) series.push({ label: `${participant}${trackId ? ` (${trackId})` : ''}`, data: data })\n })\n }\n }\n charts.push({ id, title, yLabel, datasets: series, width })\n }\n\n const kbps = (v: number) => v / 1000\n const percent = (v: number) => v * 100\n const ms = (v: number) => v * 1000\n\n ;[\n { id: '_throttle', title: 'Throttle settings' },\n { id: 'throttleUpRate', title: 'Throttle up rate', yLabel: 'Kbps', processValue: kbps, width: 2 },\n { id: 'throttleUpDelay', title: 'Throttle up delay', yLabel: 'ms', width: 2 },\n { id: 'throttleUpLoss', title: 'Throttle up loss', yLabel: '%', width: 2 },\n { id: 'throttleDownRate', title: 'Throttle down rate', yLabel: 'Kbps', processValue: kbps, width: 2 },\n { id: 'throttleDownDelay', title: 'Throttle down delay', yLabel: 'ms', width: 2 },\n { id: 'throttleDownLoss', title: 'Throttle down loss', yLabel: '%', width: 2 },\n // Performance / Connectivity\n { id: '_performance', title: 'Performance / Connectivity' },\n { id: 'pageCpu', title: 'Page CPU', yLabel: '%' },\n { id: 'pageMemory', title: 'Page memory', yLabel: 'MB' },\n { id: 'peerConnectionConnectionTime', title: 'Peer connection connection time', yLabel: 's' },\n { id: 'peerConnectionDisconnectionTime', title: 'Peer connection disconnection time', yLabel: 's' },\n // Sent audio\n { id: '_sentAudio', title: 'Sent audio' },\n { id: 'audioSentBitrates', title: 'Sent audio bitrate', yLabel: 'Kbps', processValue: kbps },\n { id: 'audioSentPacketsLossRate', title: 'Send audio loss', yLabel: '%', processValue: percent },\n { id: 'audioSentRoundTripTime', title: 'Send audio RTT', yLabel: 'ms', processValue: ms },\n { id: 'audioSentJitter', title: 'Send audio jitter', yLabel: 'ms', processValue: ms },\n // Sent video\n { id: '_sentVideo', title: 'Sent video' },\n { id: 'videoSentBitrates', title: 'Sent video bitrate', yLabel: 'Kbps', processValue: kbps },\n { id: 'videoSentPacketsLossRate', title: 'Send video loss', yLabel: '%', processValue: percent },\n { id: 'videoSentRoundTripTime', title: 'Send video RTT', yLabel: 'ms', processValue: ms },\n { id: 'videoSentJitter', title: 'Send video jitter', yLabel: 'ms', processValue: ms },\n { id: 'videoSentWidth', title: 'Send video width', yLabel: 'px' },\n { id: 'videoSentHeight', title: 'Send video height', yLabel: 'px' },\n { id: 'videoSentFps', title: 'Send video framerate', yLabel: 'fps' },\n {\n id: 'transportSentAvailableOutgoingBitrate',\n title: 'Send available bitrate',\n yLabel: 'Kbps',\n processValue: kbps,\n },\n { id: 'videoQualityLimitationCpu', title: 'Send video CPU limitation', yLabel: '%' },\n { id: 'videoQualityLimitationBandwidth', title: 'Send video bandwidth limitation', yLabel: '%' },\n { id: 'videoFirCountReceived', title: 'Send video FIR count', yLabel: 'count' },\n { id: 'videoPliCountReceived', title: 'Send video PLI count', yLabel: 'count' },\n // Sent screen\n { id: '_sentScreen', title: 'Sent screen' },\n { id: 'screenSentBitrates', title: 'Sent screen bitrate', yLabel: 'Kbps', processValue: kbps },\n { id: 'screenSentPacketsLossRate', title: 'Send screen loss', yLabel: '%', processValue: percent },\n { id: 'screenSentRoundTripTime', title: 'Send screen RTT', yLabel: 'ms', processValue: ms },\n { id: 'screenSentJitter', title: 'Send screen jitter', yLabel: 'ms', processValue: ms },\n { id: 'screenSentWidth', title: 'Send screen width', yLabel: 'px' },\n { id: 'screenSentHeight', title: 'Send screen height', yLabel: 'px' },\n { id: 'screenSentFps', title: 'Send screen framerate', yLabel: 'fps' },\n { id: '' },\n { id: 'screenQualityLimitationCpu', title: 'Send screen CPU limitation', yLabel: '%' },\n { id: 'screenQualityLimitationBandwidth', title: 'Send screen bandwidth limitation', yLabel: '%' },\n { id: 'screenFirCountReceived', title: 'Send screen FIR count', yLabel: 'count' },\n { id: 'screenPliCountReceived', title: 'Send screen PLI count', yLabel: 'count' },\n // Recv audio\n { id: '_recvAudio', title: 'Recv audio' },\n { id: 'audioRecvBitrates', title: 'Recv audio bitrate', yLabel: 'Kbps', processValue: kbps },\n { id: 'audioRecvPacketsLossRate', title: 'Recv audio loss', yLabel: '%', processValue: percent },\n { id: 'audioRecvJitter', title: 'Recv audio jitter', yLabel: 'ms', processValue: ms },\n { id: 'audioRecvAvgJitterBufferDelay', title: 'Recv audio jitter buffer', yLabel: 'ms', processValue: ms },\n { id: 'audioRecvLevel', title: 'Recv audio level', yLabel: 'db' },\n { id: 'audioRecvConcealmentEvents', title: 'Recv audio concealment events', yLabel: 'count' },\n {\n id: 'audioRecvInsertedSamplesForDeceleration',\n title: 'Recv audio inserted samples',\n yLabel: 'count',\n },\n {\n id: 'audioRecvRemovedSamplesForAcceleration',\n title: 'Recv audio removed samples',\n yLabel: 'count',\n },\n { id: 'audioRecvEndToEndDelay', title: 'Recv audio end to end delay', yLabel: 'ms', processValue: ms },\n // Recv video\n { id: '_recvVideo', title: 'Recv video' },\n { id: 'videoRecvBitrates', title: 'Recv video bitrate', yLabel: 'Kbps', processValue: kbps },\n { id: 'videoRecvPacketsLossRate', title: 'Recv video loss', yLabel: '%', processValue: percent },\n { id: 'videoRecvJitter', title: 'Recv video jitter', yLabel: 'ms', processValue: ms },\n { id: 'videoRecvAvgJitterBufferDelay', title: 'Recv video jitter buffer', yLabel: 'ms', processValue: ms },\n { id: 'videoRecvWidth', title: 'Recv video width', yLabel: 'px' },\n { id: 'videoRecvHeight', title: 'Recv video height', yLabel: 'px' },\n { id: 'videoRecvFps', title: 'Recv video framerate', yLabel: 'fps' },\n { id: 'videoTotalFreezesDuration', title: 'Recv video freezes', yLabel: 'count' },\n { id: 'videoFirCountSent', title: 'Recv video FIR sent', yLabel: 'count' },\n { id: 'videoPliCountSent', title: 'Recv video PLI sent', yLabel: 'count' },\n { id: 'videoRecvEndToEndDelay', title: 'Recv video end to end delay', yLabel: 'ms', processValue: ms },\n { id: '' },\n // Recv screen\n { id: '_recvScreen', title: 'Recv screen' },\n { id: 'screenRecvBitrates', title: 'Recv screen bitrate', yLabel: 'Kbps', processValue: kbps },\n { id: 'screenRecvPacketsLossRate', title: 'Recv screen loss', yLabel: '%', processValue: percent },\n { id: 'screenRecvJitter', title: 'Recv screen jitter', yLabel: 'ms', processValue: ms },\n { id: 'screenRecvAvgJitterBufferDelay', title: 'Recv screen jitter buffer', yLabel: 'ms', processValue: ms },\n { id: 'screenRecvWidth', title: 'Recv screen width', yLabel: 'px' },\n { id: 'screenRecvHeight', title: 'Recv screen height', yLabel: 'px' },\n { id: 'screenRecvFps', title: 'Recv screen framerate', yLabel: 'fps' },\n { id: 'screenTotalFreezesDuration', title: 'Recv screen freezes', yLabel: 'count' },\n { id: 'screenFirCountSent', title: 'Recv screen FIR sent', yLabel: 'count' },\n { id: 'screenPliCountSent', title: 'Recv screen PLI sent', yLabel: 'count' },\n { id: 'screenRecvEndToEndDelay', title: 'Recv screen end to end delay', yLabel: 'ms', processValue: ms },\n { id: '' },\n ].forEach(graph => {\n build(graph.id, graph.title, graph.yLabel, graph.processValue, graph.width)\n })\n\n const [_, id, scenario] = path.basename(path.dirname(statsFile)).split('_')\n const description = formatThrottleRule(parseThrottleRule(scenario), true, false)\n\n const data = `\\\n<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n <meta charset=\"UTF-8\">\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n <title>${id} (${description})</title>\n <link rel=\"icon\" href=\"https://raw.githubusercontent.com/vpalmisano/webrtcperf/devel/media/logo.svg\">\n <script src=\"https://cdn.jsdelivr.net/npm/chart.js\"></script>\n <script src=\"https://cdn.jsdelivr.net/npm/chartjs-chart-error-bars\"></script>\n <script src=\"https://cdn.jsdelivr.net/npm/hammerjs\"></script>\n <script src=\"https://cdn.jsdelivr.net/npm/chartjs-plugin-zoom\"></script>\n <script src=\"https://unpkg.com/vue@3/dist/vue.global.prod.js\"></script>\n <link href=\"https://cdn.jsdelivr.net/npm/@mdi/font@7.x/css/materialdesignicons.min.css\" rel=\"stylesheet\">\n <link href=\"https://cdn.jsdelivr.net/npm/vuetify@3.7.2/dist/vuetify.min.css\" rel=\"stylesheet\">\n <script src=\"https://cdn.jsdelivr.net/npm/vuetify@3.7.2/dist/vuetify.min.js\"></script>\n</head>\n<body>\n <div id=\"app\">\n <v-app>\n <v-main>\n <v-app-bar color=\"primary\" density=\"compact\">\n <v-app-bar-title><b>${id}</b> (${description})</v-app-bar-title>\n <template v-slot:append>\n <v-select color=\"primary\" :items=\"participants\" v-model=\"selected\" density=\"compact\" variant=\"solo\" hide-details=\"auto\"></v-select>\n </template>\n </v-app-bar>\n <v-container fluid>\n <v-row dense>\n <v-col v-for=\"c in charts\" :key=\"c.id\" cols=\"12\" :md=\"isExpanded(c.id) ? 12 : c.width || 3\">\n <template v-if=\"c.id\">\n <v-card color=\"primary\" :variant=\"c.id.startsWith('_') ? 'tonal' : 'text'\">\n <v-card-title class=\"text-subtitle-1 d-flex align-center flex-nowrap\" @click=\"toggleExpanded(c)\" style=\"cursor: pointer;\">\n <span class=\"text-truncate\">{{ c.title }}</span>\n </v-card-title>\n <v-card-text v-if=\"!c.id.startsWith('_')\" style=\"min-height: 250px;\">\n <canvas :id=\"c.id\"></canvas>\n </v-card-text>\n </v-card>\n </template>\n <template v-else>\n <div class=\"empty-slot\"></div>\n </template>\n </v-col>\n </v-row>\n </v-container>\n <v-footer color=\"primary\" density=\"compact\">\n <v-btn class=\"text-none\" variant=\"text\" density=\"compact\" size=\"small\" href=\"https://github.com/vpalmisano/webrtcperf\" target=\"_blank\">Generated with webrtcperf</v-btn>\n </v-footer>\n </v-main>\n </v-app>\n </div>\n\n <script>\n const { createApp, onMounted, nextTick, watch, ref } = Vue;\n const vuetify = Vuetify.createVuetify();\n const PARTICIPANTS = ${json5.stringify(['All', ...participants])};\n const CHARTS = ${json5.stringify(charts)};\n const SERIES_COLORS = ${json5.stringify(SERIES_COLORS)};\n\n function fmtTime(v) {\n const d = new Date(Number(v));\n if (!isFinite(d.getTime())) return v;\n const pad = n => String(n).padStart(2, '0');\n return pad(d.getHours()) + ':' + pad(d.getMinutes())\n }\n\n function buildDatasets(datasets, selected) {\n const filtered = selected === 'All' ? datasets : datasets.filter(d => d.label.startsWith(selected));\n return filtered.map((s, i) => ({\n label: s.label,\n data: s.data,\n fill: false,\n backgroundColor: SERIES_COLORS[i % SERIES_COLORS.length],\n borderColor: SERIES_COLORS[i % SERIES_COLORS.length],\n borderWidth: 1,\n pointRadius: 0,\n }));\n }\n\n createApp({\n setup() {\n const participants = ref(PARTICIPANTS);\n const selected = ref('All');\n const charts = ref(CHARTS);\n const chartInstances = new Map();\n const expanded = ref(new Set());\n\n function onPanZoom({ chart }) {\n const x = chart.scales.x;\n if (!x) return;\n // Sync zoom level across all charts\n for (const { chart: otherChart } of chartInstances.values()) {\n if (otherChart !== chart) {\n const otherX = otherChart.scales.x;\n if (otherX) {\n otherX.options.min = x.min;\n otherX.options.max = x.max;\n otherChart.update('none');\n }\n }\n }\n }\n\n function createPanel(chartSpec) {\n const canvas = document.getElementById(chartSpec.id);\n if (!canvas) return;\n const ctx = canvas.getContext('2d');\n const chart = new Chart(ctx, {\n type: 'line',\n options: {\n maintainAspectRatio: false,\n animation: false,\n layout: {\n padding: 0,\n },\n interaction: {\n intersect: false,\n mode: 'x',\n },\n plugins: {\n tooltip: {\n callbacks: {\n title: (context) => {\n if (context[0].parsed.x !== null) {\n return fmtTime(context[0].parsed.x);\n }\n return '';\n },\n label: (context) => {\n return context.parsed.y;\n }\n },\n },\n legend: { \n display: true,\n position: 'bottom',\n align: 'start',\n maxHeight: 50,\n labels: {\n boxWidth: 8,\n boxHeight: 8,\n font: {\n size: 8,\n lineHeight: 1,\n },\n },\n },\n zoom: {\n pan: {\n enabled: true,\n mode: 'x',\n modifierKey: 'ctrl',\n onPan: onPanZoom,\n },\n zoom: {\n drag: { enabled: true },\n mode: 'x',\n onZoom: onPanZoom,\n },\n },\n },\n scales: {\n x: { \n type: 'linear',\n title: { display: false, text: 'Time' },\n ticks: { display: true, callback: (value) => fmtTime(value) },\n },\n y: {\n type: 'linear',\n title: { display: true, text: chartSpec.yLabel },\n min: 0,\n },\n },\n },\n data: { datasets: buildDatasets(chartSpec.datasets, selected.value) },\n });\n chartInstances.set(chartSpec.id, { chart, spec: chartSpec });\n\n canvas.addEventListener('contextmenu', e => {\n e.preventDefault();\n resetZoom();\n });\n }\n\n function rebuildCharts() {\n for (const { chart } of chartInstances.values()) chart.destroy();\n chartInstances.clear();\n nextTick(() => charts.value.forEach(createPanel));\n }\n\n function applyFilter() {\n for (const { chart, spec } of chartInstances.values()) {\n chart.data.datasets = buildDatasets(spec.datasets, selected.value);\n chart.update();\n }\n }\n\n function resetZoom() {\n for (const { chart } of chartInstances.values()) {\n chart.resetZoom('none');\n if (chart.scales.x) {\n chart.scales.x.options.min = undefined;\n chart.scales.x.options.max = undefined;\n }\n chart.update('none');\n }\n }\n\n function toggleExpanded(c) {\n const id = c.id;\n const s = new Set(expanded.value);\n if (s.has(id)) s.delete(id); else s.add(id);\n expanded.value = s;\n nextTick(() => { const entry = chartInstances.get(id); entry?.chart?.resize(); });\n }\n\n function isExpanded(id) {\n return id.startsWith('_') || expanded.value.has(id);\n }\n\n onMounted(() => {\n nextTick(() => charts.value.forEach(createPanel));\n window.addEventListener('resize', () => { for (const { chart } of chartInstances.values()) chart.resize(); });\n });\n\n watch(selected, () => applyFilter());\n\n return { participants, selected, charts, resetZoom, toggleExpanded, isExpanded };\n }\n }).use(vuetify).mount('#app');\n </script>\n</body>\n</html>`\n\n await fs.promises.writeFile(outFile, data)\n}\n"]}
1
+ {"version":3,"file":"plot.js","sourceRoot":"","sources":["../../src/plot.ts"],"names":[],"mappings":";;;;;AAiCA,gCA+DC;AAED,oBAmCC;AAED,4BA6BC;AAuBD,gEA4YC;AAvkBD,4CAAmB;AAEnB,mCAAgC;AAChC,kDAAyB;AACzB,2CAA6F;AAC7F,gDAAuB;AAEvB,MAAM,GAAG,GAAG,IAAA,cAAM,EAAC,iBAAiB,CAAC,CAAA;AAkBrC,MAAM,aAAa,GAAG;IACpB,uBAAuB;IACvB,sBAAsB;IACtB,sBAAsB;IACtB,sBAAsB;IACtB,uBAAuB;CACxB,CAAA;AAED,SAAgB,UAAU,CAAC,OAAoB,EAAE,MAAkB;IACjE,GAAG,CAAC,KAAK,CAAC,YAAY,CAAC,CAAA;IAEvB,OAAO;QACL,8DAA8D;QAC9D,IAAI,EAAE,CAAC,OAAO,CAAC,IAAI,IAAI,MAAM,CAAQ;QACrC,OAAO,EAAE;YACP,OAAO,EAAE;gBACP,KAAK,EAAE,OAAO,CAAC,KAAK;oBAClB,CAAC,CAAC;wBACE,OAAO,EAAE,IAAI;wBACb,IAAI,EAAE,OAAO,CAAC,KAAK;qBACpB;oBACH,CAAC,CAAC,SAAS;gBACb,IAAI,EAAE;oBACJ,GAAG,EAAE;wBACH,OAAO,EAAE,IAAI;wBACb,IAAI,EAAE,GAAG;wBACT,WAAW,EAAE,MAAM;qBACpB;oBACD,IAAI,EAAE;wBACJ,IAAI,EAAE;4BACJ,OAAO,EAAE,IAAI;yBAC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;;;;;;;;;;;;;;;;;;;;;;2BAkCvD,eAAK,CAAC,SAAS,CAAC,CAAC,KAAK,EAAE,GAAG,YAAY,CAAC,CAAC;qBAC/C,eAAK,CAAC,SAAS,CAAC,MAAM,CAAC;4BAChB,eAAK,CAAC,SAAS,CAAC,aAAa,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QA+KlD,CAAA;IAEN,MAAM,YAAE,CAAC,QAAQ,CAAC,SAAS,CAAC,OAAO,EAAE,IAAI,CAAC,CAAA;AAC5C,CAAC","sourcesContent":["import fs from 'fs'\n\nimport { logger } from './utils'\nimport json5 from 'json5'\nimport { formatThrottleRule, parseStatsFile, parseThrottleRule, StatsRow } from './scenarios'\nimport path from 'path'\n\nconst log = logger('webrtcperf:plot')\n\nexport type PlotOptions = {\n type?: string\n title?: string\n xLabel?: string\n yLabel?: string\n yMin?: number\n yMax?: number\n labels?: (string | number)[]\n filePath?: string\n}\n\nexport type PlotData = {\n label: string\n data: { x: number | string; y: number; yMin?: number; yMax?: number }[]\n}\n\nconst SERIES_COLORS = [\n 'rgba(33, 150, 243, 1)',\n 'rgba(244, 67, 54, 1)',\n 'rgba(76, 175, 80, 1)',\n 'rgba(255, 193, 7, 1)',\n 'rgba(156, 39, 176, 1)',\n]\n\nexport function plotConfig(options: PlotOptions, series: PlotData[]) {\n log.debug('plotConfig')\n\n return {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n type: (options.type || 'line') as any,\n options: {\n plugins: {\n title: options.title\n ? {\n display: true,\n text: options.title,\n }\n : undefined,\n zoom: {\n pan: {\n enabled: true,\n mode: 'x',\n modifierKey: 'ctrl',\n },\n zoom: {\n drag: {\n enabled: true,\n },\n mode: 'x',\n },\n },\n },\n scales: {\n x: {\n type: 'category',\n title: options.xLabel\n ? {\n display: true,\n text: options.xLabel,\n }\n : undefined,\n },\n y: {\n type: 'linear',\n title: options.yLabel\n ? {\n display: true,\n text: options.yLabel,\n }\n : undefined,\n min: options.yMin,\n max: options.yMax,\n },\n },\n },\n data: {\n labels: options.labels,\n datasets: series.map((s, i) => ({\n fill: false,\n backgroundColor: SERIES_COLORS[i % SERIES_COLORS.length],\n borderColor: SERIES_COLORS[i % SERIES_COLORS.length],\n borderWidth: 1,\n pointRadius: 0,\n ...s,\n })),\n },\n }\n}\n\nexport async function plot(options: PlotOptions, series: PlotData[]) {\n const {\n CategoryScale,\n Chart,\n LinearScale,\n LineController,\n BarController,\n LineElement,\n BarElement,\n PointElement,\n Legend,\n Title,\n } = await import('chart.js')\n const { BarWithErrorBar, BarWithErrorBarsController } = await import('chartjs-chart-error-bars')\n Chart.register(\n CategoryScale,\n LineController,\n LineElement,\n BarController,\n LinearScale,\n BarElement,\n PointElement,\n Legend,\n Title,\n BarWithErrorBar,\n BarWithErrorBarsController,\n )\n const { Canvas } = await import('skia-canvas')\n\n log.debug('plot')\n const config = plotConfig(options, series)\n const canvas = new Canvas(1280, 720)\n const chart = new Chart(canvas as unknown as HTMLCanvasElement, config)\n await canvas.toFile(options.filePath || 'plot.png', { format: 'png', matte: 'white' })\n chart.destroy()\n}\n\nexport async function plotHtml(options: PlotOptions, series: PlotData[]) {\n log.debug('plotHtml')\n const config = plotConfig(options, series)\n\n const data = `\n<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n <meta charset=\"UTF-8\">\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n <title>${options.title || 'Plot'}</title>\n <script src=\"https://cdn.jsdelivr.net/npm/chart.js\"></script>\n <script src=\"https://cdn.jsdelivr.net/npm/chartjs-chart-error-bars\"></script>\n <script src=\"https://cdn.jsdelivr.net/npm/hammerjs\"></script>\n <script src=\"https://cdn.jsdelivr.net/npm/chartjs-plugin-zoom\"></script>\n</head>\n<body>\n <div>\n <canvas id=\"chart\"></canvas>\n </div>\n <script>\n const ctx = document.getElementById('chart');\n const chart = new Chart(ctx, ${json5.stringify(config)});\n chart.options.onClick = e => e.chart.resetZoom();\n addEventListener('resize', () => chart.resize());\n </script>\n</body>\n</html>`\n await fs.promises.writeFile(options.filePath || 'plot.html', data)\n}\n\nfunction groupByParticipant(rows: StatsRow[]) {\n const m = new Map<string, StatsRow[]>()\n for (const r of rows) {\n if (!r.participantName) continue\n const p = r.participantName as string\n if (!m.has(p)) m.set(p, [])\n m.get(p)!.push(r)\n }\n return m\n}\n\n/**\n * It plots a detailed stats dashboard from a CSV file.\n * @param statsFile The path to the CSV file containing the detailed stats.\n * @param outFile The path to the output HTML file.\n * @returns A promise that resolves when the plot is complete.\n * @example\n * ```bash\n * webrtcperf --plot logs/detailed-stats.csv plot.html\n * ```\n */\nexport async function plotDetailedStatsDashboard(statsFile: string, outFile = 'plot.html') {\n log.info(`Plotting detailed stats from ${statsFile} to ${outFile}`)\n\n const rows = await parseStatsFile(statsFile)\n if (rows.length === 0) {\n log.warn('No stats found')\n return\n }\n\n const byParticipant = groupByParticipant(rows)\n const participants = Array.from(byParticipant.keys()).sort()\n\n type ChartSpec = { id: string; title?: string; yLabel?: string; datasets?: PlotData[]; width?: number }\n const charts: ChartSpec[] = []\n\n const build = (\n id: string,\n title?: string,\n yLabel?: string,\n processValue?: (value: number) => number,\n width?: number,\n ) => {\n const series: PlotData[] = []\n if (!id.startsWith('_')) {\n for (const [participant, rows] of byParticipant.entries()) {\n const dataPerTrack = new Map<string, { x: number; y: number }[]>()\n for (const r of rows) {\n const trackId = (r.trackId as string) || ''\n if (!dataPerTrack.has(trackId)) dataPerTrack.set(trackId, [])\n const data = dataPerTrack.get(trackId)!\n const v = r[id] as number\n if (v !== undefined) data.push({ x: r.datetime as number, y: processValue ? processValue(v) : v })\n }\n dataPerTrack.forEach((data, trackId) => {\n if (data.length) series.push({ label: `${participant}${trackId ? ` (${trackId})` : ''}`, data: data })\n })\n }\n }\n charts.push({ id, title, yLabel, datasets: series, width })\n }\n\n const kbps = (v: number) => v / 1000\n const percent = (v: number) => v * 100\n const ms = (v: number) => v * 1000\n\n ;[\n { id: '_throttle', title: 'Throttle settings' },\n { id: 'throttleUpRate', title: 'Throttle up rate', yLabel: 'Kbps', processValue: kbps, width: 2 },\n { id: 'throttleUpDelay', title: 'Throttle up delay', yLabel: 'ms', width: 2 },\n { id: 'throttleUpLoss', title: 'Throttle up loss', yLabel: '%', width: 2 },\n { id: 'throttleDownRate', title: 'Throttle down rate', yLabel: 'Kbps', processValue: kbps, width: 2 },\n { id: 'throttleDownDelay', title: 'Throttle down delay', yLabel: 'ms', width: 2 },\n { id: 'throttleDownLoss', title: 'Throttle down loss', yLabel: '%', width: 2 },\n // Performance / Connectivity\n { id: '_performance', title: 'Performance / Connectivity' },\n { id: 'pageCpu', title: 'Page CPU', yLabel: '%' },\n { id: 'pageMemory', title: 'Page memory', yLabel: 'MB' },\n { id: 'peerConnectionConnectionTime', title: 'Peer connection connection time', yLabel: 's' },\n { id: 'peerConnectionDisconnectionTime', title: 'Peer connection disconnection time', yLabel: 's' },\n // Sent audio\n { id: '_sentAudio', title: 'Sent audio' },\n { id: 'audioSentBitrates', title: 'Sent audio bitrate', yLabel: 'Kbps', processValue: kbps },\n { id: 'audioSentPacketsLossRate', title: 'Send audio loss', yLabel: '%', processValue: percent },\n { id: 'audioSentRoundTripTime', title: 'Send audio RTT', yLabel: 'ms', processValue: ms },\n { id: 'audioSentJitter', title: 'Send audio jitter', yLabel: 'ms', processValue: ms },\n // Sent video\n { id: '_sentVideo', title: 'Sent video' },\n { id: 'videoSentBitrates', title: 'Sent video bitrate', yLabel: 'Kbps', processValue: kbps },\n { id: 'videoSentPacketsLossRate', title: 'Send video loss', yLabel: '%', processValue: percent },\n { id: 'videoSentRoundTripTime', title: 'Send video RTT', yLabel: 'ms', processValue: ms },\n { id: 'videoSentJitter', title: 'Send video jitter', yLabel: 'ms', processValue: ms },\n { id: 'videoSentWidth', title: 'Send video width', yLabel: 'px' },\n { id: 'videoSentHeight', title: 'Send video height', yLabel: 'px' },\n { id: 'videoSentFps', title: 'Send video framerate', yLabel: 'fps' },\n {\n id: 'transportSentAvailableOutgoingBitrate',\n title: 'Send available bitrate',\n yLabel: 'Kbps',\n processValue: kbps,\n },\n { id: 'videoQualityLimitationCpu', title: 'Send video CPU limitation', yLabel: '%' },\n { id: 'videoQualityLimitationBandwidth', title: 'Send video bandwidth limitation', yLabel: '%' },\n { id: 'videoFirCountReceived', title: 'Send video FIR count', yLabel: 'count' },\n { id: 'videoPliCountReceived', title: 'Send video PLI count', yLabel: 'count' },\n // Sent screen\n { id: '_sentScreen', title: 'Sent screen' },\n { id: 'screenSentBitrates', title: 'Sent screen bitrate', yLabel: 'Kbps', processValue: kbps },\n { id: 'screenSentPacketsLossRate', title: 'Send screen loss', yLabel: '%', processValue: percent },\n { id: 'screenSentRoundTripTime', title: 'Send screen RTT', yLabel: 'ms', processValue: ms },\n { id: 'screenSentJitter', title: 'Send screen jitter', yLabel: 'ms', processValue: ms },\n { id: 'screenSentWidth', title: 'Send screen width', yLabel: 'px' },\n { id: 'screenSentHeight', title: 'Send screen height', yLabel: 'px' },\n { id: 'screenSentFps', title: 'Send screen framerate', yLabel: 'fps' },\n { id: '' },\n { id: 'screenQualityLimitationCpu', title: 'Send screen CPU limitation', yLabel: '%' },\n { id: 'screenQualityLimitationBandwidth', title: 'Send screen bandwidth limitation', yLabel: '%' },\n { id: 'screenFirCountReceived', title: 'Send screen FIR count', yLabel: 'count' },\n { id: 'screenPliCountReceived', title: 'Send screen PLI count', yLabel: 'count' },\n // Recv audio\n { id: '_recvAudio', title: 'Recv audio' },\n { id: 'audioRecvBitrates', title: 'Recv audio bitrate', yLabel: 'Kbps', processValue: kbps },\n { id: 'audioRecvPacketsLossRate', title: 'Recv audio loss', yLabel: '%', processValue: percent },\n { id: 'audioRecvJitter', title: 'Recv audio jitter', yLabel: 'ms', processValue: ms },\n { id: 'audioRecvAvgJitterBufferDelay', title: 'Recv audio jitter buffer', yLabel: 'ms', processValue: ms },\n { id: 'audioRecvLevel', title: 'Recv audio level', yLabel: 'db' },\n { id: 'audioRecvConcealmentEvents', title: 'Recv audio concealment events', yLabel: 'count' },\n {\n id: 'audioRecvInsertedSamplesForDeceleration',\n title: 'Recv audio inserted samples',\n yLabel: 'count',\n },\n {\n id: 'audioRecvRemovedSamplesForAcceleration',\n title: 'Recv audio removed samples',\n yLabel: 'count',\n },\n { id: 'audioRecvEndToEndDelay', title: 'Recv audio end to end delay', yLabel: 'ms', processValue: ms },\n // Recv video\n { id: '_recvVideo', title: 'Recv video' },\n { id: 'videoRecvBitrates', title: 'Recv video bitrate', yLabel: 'Kbps', processValue: kbps },\n { id: 'videoRecvPacketsLossRate', title: 'Recv video loss', yLabel: '%', processValue: percent },\n { id: 'videoRecvJitter', title: 'Recv video jitter', yLabel: 'ms', processValue: ms },\n { id: 'videoRecvAvgJitterBufferDelay', title: 'Recv video jitter buffer', yLabel: 'ms', processValue: ms },\n { id: 'videoRecvWidth', title: 'Recv video width', yLabel: 'px' },\n { id: 'videoRecvHeight', title: 'Recv video height', yLabel: 'px' },\n { id: 'videoRecvFps', title: 'Recv video framerate', yLabel: 'fps' },\n { id: 'videoTotalFreezesDuration', title: 'Recv video freezes', yLabel: 'count' },\n { id: 'videoFirCountSent', title: 'Recv video FIR sent', yLabel: 'count' },\n { id: 'videoPliCountSent', title: 'Recv video PLI sent', yLabel: 'count' },\n { id: 'videoRecvEndToEndDelay', title: 'Recv video end to end delay', yLabel: 'ms', processValue: ms },\n { id: '' },\n // Recv screen\n { id: '_recvScreen', title: 'Recv screen' },\n { id: 'screenRecvBitrates', title: 'Recv screen bitrate', yLabel: 'Kbps', processValue: kbps },\n { id: 'screenRecvPacketsLossRate', title: 'Recv screen loss', yLabel: '%', processValue: percent },\n { id: 'screenRecvJitter', title: 'Recv screen jitter', yLabel: 'ms', processValue: ms },\n { id: 'screenRecvAvgJitterBufferDelay', title: 'Recv screen jitter buffer', yLabel: 'ms', processValue: ms },\n { id: 'screenRecvWidth', title: 'Recv screen width', yLabel: 'px' },\n { id: 'screenRecvHeight', title: 'Recv screen height', yLabel: 'px' },\n { id: 'screenRecvFps', title: 'Recv screen framerate', yLabel: 'fps' },\n { id: 'screenTotalFreezesDuration', title: 'Recv screen freezes', yLabel: 'count' },\n { id: 'screenFirCountSent', title: 'Recv screen FIR sent', yLabel: 'count' },\n { id: 'screenPliCountSent', title: 'Recv screen PLI sent', yLabel: 'count' },\n { id: 'screenRecvEndToEndDelay', title: 'Recv screen end to end delay', yLabel: 'ms', processValue: ms },\n { id: '' },\n ].forEach(graph => {\n build(graph.id, graph.title, graph.yLabel, graph.processValue, graph.width)\n })\n\n const dirName = path.basename(path.dirname(statsFile))\n let title = dirName\n let description = ''\n try {\n const [_, id, scenario] = dirName.split('_')\n title = id\n description = formatThrottleRule(parseThrottleRule(scenario), true, false)\n } catch (error) {\n log.debug(`Invalid directory name: ${dirName}`, error)\n }\n\n const data = `\\\n<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n <meta charset=\"UTF-8\">\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n <title>${title} (${description})</title>\n <link rel=\"icon\" href=\"https://raw.githubusercontent.com/vpalmisano/webrtcperf/devel/media/logo.svg\">\n <script src=\"https://cdn.jsdelivr.net/npm/chart.js\"></script>\n <script src=\"https://cdn.jsdelivr.net/npm/chartjs-chart-error-bars\"></script>\n <script src=\"https://cdn.jsdelivr.net/npm/hammerjs\"></script>\n <script src=\"https://cdn.jsdelivr.net/npm/chartjs-plugin-zoom\"></script>\n <script src=\"https://unpkg.com/vue@3/dist/vue.global.prod.js\"></script>\n <link href=\"https://cdn.jsdelivr.net/npm/@mdi/font@7.x/css/materialdesignicons.min.css\" rel=\"stylesheet\">\n <link href=\"https://cdn.jsdelivr.net/npm/vuetify@3.7.2/dist/vuetify.min.css\" rel=\"stylesheet\">\n <script src=\"https://cdn.jsdelivr.net/npm/vuetify@3.7.2/dist/vuetify.min.js\"></script>\n</head>\n<body>\n <div id=\"app\">\n <v-app>\n <v-main>\n <v-app-bar color=\"primary\" density=\"compact\">\n <v-app-bar-title><b>${title}</b>${description ? ` (${description})` : ''}</v-app-bar-title>\n <template v-slot:append>\n <v-select color=\"primary\" :items=\"participants\" v-model=\"selected\" density=\"compact\" variant=\"solo\" hide-details=\"auto\"></v-select>\n </template>\n </v-app-bar>\n <v-container fluid>\n <v-row dense>\n <v-col v-for=\"c in charts\" :key=\"c.id\" cols=\"12\" :md=\"isExpanded(c.id) ? 12 : c.width || 3\">\n <template v-if=\"c.id\">\n <v-card color=\"primary\" :variant=\"c.id.startsWith('_') ? 'tonal' : 'text'\">\n <v-card-title class=\"text-subtitle-1 d-flex align-center flex-nowrap\" @click=\"toggleExpanded(c)\" style=\"cursor: pointer;\">\n <span class=\"text-truncate\">{{ c.title }}</span>\n </v-card-title>\n <v-card-text v-if=\"!c.id.startsWith('_')\" style=\"min-height: 250px;\">\n <canvas :id=\"c.id\"></canvas>\n </v-card-text>\n </v-card>\n </template>\n <template v-else>\n <div class=\"empty-slot\"></div>\n </template>\n </v-col>\n </v-row>\n </v-container>\n <v-footer color=\"primary\" density=\"compact\">\n <v-btn class=\"text-none\" variant=\"text\" density=\"compact\" size=\"small\" href=\"https://github.com/vpalmisano/webrtcperf\" target=\"_blank\">Generated with webrtcperf</v-btn>\n </v-footer>\n </v-main>\n </v-app>\n </div>\n\n <script>\n const { createApp, onMounted, nextTick, watch, ref } = Vue;\n const vuetify = Vuetify.createVuetify();\n const PARTICIPANTS = ${json5.stringify(['All', ...participants])};\n const CHARTS = ${json5.stringify(charts)};\n const SERIES_COLORS = ${json5.stringify(SERIES_COLORS)};\n\n function fmtTime(v) {\n const d = new Date(Number(v));\n if (!isFinite(d.getTime())) return v;\n const pad = n => String(n).padStart(2, '0');\n return pad(d.getHours()) + ':' + pad(d.getMinutes())\n }\n\n function buildDatasets(datasets, selected) {\n const filtered = selected === 'All' ? datasets : datasets.filter(d => d.label.startsWith(selected));\n return filtered.map((s, i) => ({\n label: s.label,\n data: s.data,\n fill: false,\n backgroundColor: SERIES_COLORS[i % SERIES_COLORS.length],\n borderColor: SERIES_COLORS[i % SERIES_COLORS.length],\n borderWidth: 1,\n pointRadius: 0,\n }));\n }\n\n createApp({\n setup() {\n const participants = ref(PARTICIPANTS);\n const selected = ref('All');\n const charts = ref(CHARTS);\n const chartInstances = new Map();\n const expanded = ref(new Set());\n\n function onPanZoom({ chart }) {\n const x = chart.scales.x;\n if (!x) return;\n // Sync zoom level across all charts\n for (const { chart: otherChart } of chartInstances.values()) {\n if (otherChart !== chart) {\n const otherX = otherChart.scales.x;\n if (otherX) {\n otherX.options.min = x.min;\n otherX.options.max = x.max;\n otherChart.update('none');\n }\n }\n }\n }\n\n function createPanel(chartSpec) {\n const canvas = document.getElementById(chartSpec.id);\n if (!canvas) return;\n const ctx = canvas.getContext('2d');\n const chart = new Chart(ctx, {\n type: 'line',\n options: {\n maintainAspectRatio: false,\n animation: false,\n layout: {\n padding: 0,\n },\n interaction: {\n intersect: false,\n mode: 'x',\n },\n plugins: {\n tooltip: {\n callbacks: {\n title: (context) => {\n if (context[0].parsed.x !== null) {\n return fmtTime(context[0].parsed.x);\n }\n return '';\n },\n label: (context) => {\n return context.parsed.y;\n }\n },\n },\n legend: { \n display: true,\n position: 'bottom',\n align: 'start',\n maxHeight: 50,\n labels: {\n boxWidth: 8,\n boxHeight: 8,\n font: {\n size: 8,\n lineHeight: 1,\n },\n },\n },\n zoom: {\n pan: {\n enabled: true,\n mode: 'x',\n modifierKey: 'ctrl',\n onPan: onPanZoom,\n },\n zoom: {\n drag: { enabled: true },\n mode: 'x',\n onZoom: onPanZoom,\n },\n },\n },\n scales: {\n x: { \n type: 'linear',\n title: { display: false, text: 'Time' },\n ticks: { display: true, callback: (value) => fmtTime(value) },\n },\n y: {\n type: 'linear',\n title: { display: true, text: chartSpec.yLabel },\n min: 0,\n },\n },\n },\n data: { datasets: buildDatasets(chartSpec.datasets, selected.value) },\n });\n chartInstances.set(chartSpec.id, { chart, spec: chartSpec });\n\n canvas.addEventListener('contextmenu', e => {\n e.preventDefault();\n resetZoom();\n });\n }\n\n function rebuildCharts() {\n for (const { chart } of chartInstances.values()) chart.destroy();\n chartInstances.clear();\n nextTick(() => charts.value.forEach(createPanel));\n }\n\n function applyFilter() {\n for (const { chart, spec } of chartInstances.values()) {\n chart.data.datasets = buildDatasets(spec.datasets, selected.value);\n chart.update();\n }\n }\n\n function resetZoom() {\n for (const { chart } of chartInstances.values()) {\n chart.resetZoom('none');\n if (chart.scales.x) {\n chart.scales.x.options.min = undefined;\n chart.scales.x.options.max = undefined;\n }\n chart.update('none');\n }\n }\n\n function toggleExpanded(c) {\n const id = c.id;\n const s = new Set(expanded.value);\n if (s.has(id)) s.delete(id); else s.add(id);\n expanded.value = s;\n nextTick(() => { const entry = chartInstances.get(id); entry?.chart?.resize(); });\n }\n\n function isExpanded(id) {\n return id.startsWith('_') || expanded.value.has(id);\n }\n\n onMounted(() => {\n nextTick(() => charts.value.forEach(createPanel));\n window.addEventListener('resize', () => { for (const { chart } of chartInstances.values()) chart.resize(); });\n });\n\n watch(selected, () => applyFilter());\n\n return { participants, selected, charts, resetZoom, toggleExpanded, isExpanded };\n }\n }).use(vuetify).mount('#app');\n </script>\n</body>\n</html>`\n\n await fs.promises.writeFile(outFile, data)\n}\n"]}
@@ -234,6 +234,8 @@ export declare enum RtcStatsMetricNames {
234
234
  videoFirCountSent = "videoFirCountSent",
235
235
  videoPliCountSent = "videoPliCountSent",
236
236
  videoDecodeLatency = "videoDecodeLatency",
237
+ videoFramesDecoded = "videoFramesDecoded",
238
+ videoFramesDropped = "videoFramesDropped",
237
239
  videoRecvFrames = "videoRecvFrames",
238
240
  videoRecvFps = "videoRecvFps",
239
241
  videoRecvAvgJitterBufferDelay = "videoRecvAvgJitterBufferDelay",
@@ -256,6 +258,8 @@ export declare enum RtcStatsMetricNames {
256
258
  screenFirCountSent = "screenFirCountSent",
257
259
  screenPliCountSent = "screenPliCountSent",
258
260
  screenDecodeLatency = "screenDecodeLatency",
261
+ screenFramesDecoded = "screenFramesDecoded",
262
+ screenFramesDropped = "screenFramesDropped",
259
263
  screenRecvFrames = "screenRecvFrames",
260
264
  screenRecvFps = "screenRecvFps",
261
265
  screenRecvAvgJitterBufferDelay = "screenRecvAvgJitterBufferDelay",
@@ -254,7 +254,8 @@ var RtcStatsMetricNames;
254
254
  RtcStatsMetricNames["videoFirCountSent"] = "videoFirCountSent";
255
255
  RtcStatsMetricNames["videoPliCountSent"] = "videoPliCountSent";
256
256
  RtcStatsMetricNames["videoDecodeLatency"] = "videoDecodeLatency";
257
- //'videoFramesDecoded',
257
+ RtcStatsMetricNames["videoFramesDecoded"] = "videoFramesDecoded";
258
+ RtcStatsMetricNames["videoFramesDropped"] = "videoFramesDropped";
258
259
  RtcStatsMetricNames["videoRecvFrames"] = "videoRecvFrames";
259
260
  RtcStatsMetricNames["videoRecvFps"] = "videoRecvFps";
260
261
  RtcStatsMetricNames["videoRecvAvgJitterBufferDelay"] = "videoRecvAvgJitterBufferDelay";
@@ -279,7 +280,8 @@ var RtcStatsMetricNames;
279
280
  RtcStatsMetricNames["screenFirCountSent"] = "screenFirCountSent";
280
281
  RtcStatsMetricNames["screenPliCountSent"] = "screenPliCountSent";
281
282
  RtcStatsMetricNames["screenDecodeLatency"] = "screenDecodeLatency";
282
- //'screenFramesDecoded',
283
+ RtcStatsMetricNames["screenFramesDecoded"] = "screenFramesDecoded";
284
+ RtcStatsMetricNames["screenFramesDropped"] = "screenFramesDropped";
283
285
  RtcStatsMetricNames["screenRecvFrames"] = "screenRecvFrames";
284
286
  RtcStatsMetricNames["screenRecvFps"] = "screenRecvFps";
285
287
  RtcStatsMetricNames["screenRecvAvgJitterBufferDelay"] = "screenRecvAvgJitterBufferDelay";
@@ -373,7 +375,8 @@ value, signalingHost, participantName) {
373
375
  });
374
376
  }
375
377
  if (inboundRtp.kind === 'video' && inboundRtp.keyFramesDecoded > 0) {
376
- //setStats(stats, prefix + 'FramesDecoded', key, inboundRtp.framesDecoded
378
+ setStats(stats, (prefix + 'FramesDecoded'), key, inboundRtp.framesDecoded);
379
+ setStats(stats, (prefix + 'FramesDropped'), key, inboundRtp.framesDropped);
377
380
  setStats(stats, (prefix + 'RecvFrames'), key, inboundRtp.framesReceived);
378
381
  setStats(stats, (prefix + 'RecvFps'), key, inboundRtp.framesPerSecond);
379
382
  setStats(stats, (prefix + 'RecvHeight'), key, inboundRtp.frameHeight);
@@ -1 +1 @@
1
- {"version":3,"file":"rtcstats.js","sourceRoot":"","sources":["../../src/rtcstats.ts"],"names":[],"mappings":";;;;;;AA6UA,gCAcC;AAED,wCAeC;AAKD,wCA+IC;AAhgBD,oDAA2B;AAE3B,mCAAqC;AAErC;;GAEG;AACH,IAAY,cAqGX;AArGD,WAAY,cAAc;IACxB,kDAAkD;IAClD,6BAAW,CAAA;IACX,qDAAqD;IACrD,mCAAiB,CAAA;IACjB,iCAAiC;IACjC,qCAAmB,CAAA;IACnB,oCAAoC;IACpC,2CAAyB,CAAA;IACzB,kCAAkC;IAClC,qCAAmB,CAAA;IACnB,qCAAqC;IACrC,2CAAyB,CAAA;IACzB,kCAAkC;IAClC,qCAAmB,CAAA;IACnB,0BAA0B;IAC1B,qCAAmB,CAAA;IACnB,6BAA6B;IAC7B,2CAAyB,CAAA;IAEzB,8BAA8B;IAC9B,iCAAe,CAAA;IACf,0CAA0C;IAC1C,qDAAmC,CAAA;IACnC,sDAAsD;IACtD,+EAA6D,CAAA;IAC7D,0DAA0D;IAC1D,qFAAmE,CAAA;IACnE,yCAAyC;IACzC,mEAAiD,CAAA;IACjD,2CAA2C;IAC3C,uEAAqD,CAAA;IACrD,wCAAwC;IACxC,iEAA+C,CAAA;IAC/C,8CAA8C;IAC9C,6EAA2D,CAAA;IAC3D,wCAAwC;IACxC,iEAA+C,CAAA;IAC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AE,CAAC,MAAM,GAAG,kBAAkB,CAAwB,EAAE,GAAG,EAAE,WAAW,CAAC,gBAAgB,CAAC,CAAA;gBACxG,QAAQ,CAAC,KAAK,EAAE,CAAC,MAAM,GAAG,eAAe,CAAwB,EAAE,GAAG,EAAE,WAAW,CAAC,aAAa,CAAC,CAAA;gBAClG,QAAQ,CAAC,KAAK,EAAE,CAAC,MAAM,GAAG,aAAa,CAAwB,EAAE,GAAG,EAAE,WAAW,CAAC,WAAW,CAAC,CAAA;YAChG,CAAC;QACH,CAAC;IACH,CAAC;AACH,CAAC","sourcesContent":["import assert from 'assert'\n\nimport { toTitleCase } from './utils'\n\n/**\n * Page stats metric names.\n */\nexport enum PageStatsNames {\n /** The browser processes CPU usage (per page). */\n cpu = 'cpu',\n /** The browser processes memory usage (per page). */\n memory = 'memory',\n /** The tool nodejs CPU usage. */\n nodeCpu = 'nodeCpu',\n /** The tool nodejs memory usage. */\n nodeMemory = 'nodeMemory',\n /** The system total CPU usage. */\n usedCpu = 'usedCpu',\n /** The system total memory usage. */\n usedMemory = 'usedMemory',\n /** The system total GPU usage. */\n usedGpu = 'usedGpu',\n /** The page CPU usage. */\n pageCpu = 'pageCpu',\n /** The page memory usage. */\n pageMemory = 'pageMemory',\n\n /** The opened pages count. */\n pages = 'pages',\n /** The current opened PeerConnections. */\n peerConnections = 'peerConnections',\n /** The maximum PeerConnections connected duration. */\n peerConnectionConnectionTime = 'peerConnectionConnectionTime',\n /** The maximum PeerConnections disconnection duration. */\n peerConnectionDisconnectionTime = 'peerConnectionDisconnectionTime',\n /** The total created PeerConnections. */\n peerConnectionsCreated = 'peerConnectionsCreated',\n /** The total connected PeerConnections. */\n peerConnectionsConnected = 'peerConnectionsConnected',\n /** The total closed PeerConnections. */\n peerConnectionsClosed = 'peerConnectionsClosed',\n /** The total disconnected PeerConnections. */\n peerConnectionsDisconnected = 'peerConnectionsDisconnected',\n /** The total failed PeerConnections. */\n peerConnectionsFailed = 'peerConnectionsFailed',\n /** The total delay from PeerConnections creation to connection. */\n peerConnectionsDelay = 'peerConnectionsDelay',\n\n /** The page errors count. */\n errors = 'errors',\n /** The page warnings count. */\n warnings = 'warnings',\n\n /** The page total HTTP sent bytes. */\n httpSentBytes = 'httpSentBytes',\n /** The page total HTTP received bytes. */\n httpRecvBytes = 'httpRecvBytes',\n /** The page HTTP receive latency. */\n httpRecvLatency = 'httpRecvLatency',\n\n /** The page total WebSocket sent bytes. */\n wsSentBytes = 'wsSentBytes',\n /** The page total WebSocket received bytes. */\n wsRecvBytes = 'wsRecvBytes',\n /** The page WebSocket receive latency. */\n wsRecvLatency = 'wsRecvLatency',\n\n /** The audio end to end total delay. */\n audioEndToEndDelay = 'audioEndToEndDelay',\n /** The audio start frame delay. */\n audioStartFrameDelay = 'audioStartFrameDelay',\n\n /** The video end to end total delay. */\n videoEndToEndDelay = 'videoEndToEndDelay',\n /** The video start frame delay. */\n videoStartFrameDelay = 'videoStartFrameDelay',\n\n /** The screen end to end total delay. */\n screenEndToEndDelay = 'screenEndToEndDelay',\n /** The screen start frame delay. */\n screenStartFrameDelay = 'screenStartFrameDelay',\n\n cpuPressure = 'cpuPressure',\n\n videoWidth = 'videoWidth',\n videoHeight = 'videoHeight',\n videoBufferedTime = 'videoBufferedTime',\n videoPlayingTime = 'videoPlayingTime',\n videoBufferingTime = 'videoBufferingTime',\n videoBufferingEvents = 'videoBufferingEvents',\n\n /** The throttle upload rate limitation. */\n throttleUpRate = 'throttleUpRate',\n /** The throttle upload delay. */\n throttleUpDelay = 'throttleUpDelay',\n /** The throttle upload packet loss. */\n throttleUpLoss = 'throttleUpLoss',\n /** The throttle upload packet queue. */\n throttleUpQueue = 'throttleUpQueue',\n\n /** The throttle download rate limitation. */\n throttleDownRate = 'throttleDownRate',\n /** The throttle download delay. */\n throttleDownDelay = 'throttleDownDelay',\n /** The throttle download packet loss. */\n throttleDownLoss = 'throttleDownLoss',\n /** The throttle download packet queue. */\n throttleDownQueue = 'throttleDownQueue',\n}\n\n/**\n * RTC metrics collected by the page helper scripts and related to each\n * track object created by PeerConnections.\n */\nexport enum RtcStatsMetricNames {\n /** The sent audio codec. */\n audioSentCodec = 'audioSentCodec',\n /** The total sent audio bytes. */\n audioSentBytes = 'audioSentBytes',\n /** The sent audio packets. */\n audioSentPackets = 'audioSentPackets',\n /** The sent audio bitrates. */\n audioSentBitrates = 'audioSentBitrates',\n /** The send audio lost packets. */\n audioSentPacketsLost = 'audioSentPacketsLost',\n //'audioSentPacketsLostCount',\n /** The total audio NACK received by the sender. */\n audioSentNackCountRecv = 'audioSentNackCountRecv',\n /** The sent audio round trip time. */\n audioSentRoundTripTime = 'audioSentRoundTripTime',\n /** The sent audio jitter. */\n audioSentJitter = 'audioSentJitter',\n /** The audio RTC transport round trip time. */\n audioSentTransportRoundTripTime = 'audioSentTransportRoundTripTime',\n /** The sent audio encoding max bitrate. */\n audioSentMaxBitrate = 'audioSentMaxBitrate',\n /** The sent audio RTX packets. */\n audioSentRetransmittedPackets = 'audioSentRetransmittedPackets',\n\n /** The sent video codec. */\n videoSentCodec = 'videoSentCodec',\n /** The FIR requests received by the video sender. */\n videoFirCountReceived = 'videoFirCountReceived',\n /** The PLI requests received by the video sender. */\n videoPliCountReceived = 'videoPliCountReceived',\n /** The sent video encode latency. */\n videoEncodeLatency = 'videoEncodeLatency',\n /** The sent video latency. */\n videoSentLatency = 'videoSentLatency',\n /** The sent video bandwidth quality limitations. */\n videoQualityLimitationBandwidth = 'videoQualityLimitationBandwidth',\n /** The sent video cpu quality limitations. */\n videoQualityLimitationCpu = 'videoQualityLimitationCpu',\n /** The sent video total resolution changes for quality limitations. */\n videoQualityLimitationResolutionChanges = 'videoQualityLimitationResolutionChanges',\n /** The sent video Simulcast active spatial layers. */\n videoSentActiveEncodings = 'videoSentActiveEncodings',\n /** The sent video bitrates. */\n videoSentBitrates = 'videoSentBitrates',\n /** The sent video bytes. */\n videoSentBytes = 'videoSentBytes',\n /** The sent video packets. */\n videoSentPackets = 'videoSentPackets',\n /** The sent video frames. */\n videoSentFrames = 'videoSentFrames',\n /** The sent video framerate. */\n videoSentFps = 'videoSentFps',\n /** The sent video width. */\n videoSentWidth = 'videoSentWidth',\n /** The sent video height. */\n videoSentHeight = 'videoSentHeight',\n /** The sent video encoding max bitrate. */\n videoSentMaxBitrate = 'videoSentMaxBitrate',\n //'videoSentPackets',\n /** The sent video lost packets. */\n videoSentPacketsLost = 'videoSentPacketsLost',\n //'videoSentPacketsLostCount',\n /** The NACK count received by video sender. */\n videoSentNackCountRecv = 'videoSentNackCountRecv',\n /** The sent video round trip time. */\n videoSentRoundTripTime = 'videoSentRoundTripTime',\n /** The transport send video round trip time. */\n videoSentTransportRoundTripTime = 'videoSentTransportRoundTripTime',\n /** The video sent jitter. */\n videoSentJitter = 'videoSentJitter',\n /** The sent video RTX packets. */\n videoSentRetransmittedPackets = 'videoSentRetransmittedPackets',\n\n /** The sent screen codec. */\n screenSentCodec = 'screenSentCodec',\n /** The received FIR from screen sender. */\n screenFirCountReceived = 'screenFirCountReceived',\n /** The received PLI from screen sender. */\n screenPliCountReceived = 'screenPliCountReceived',\n /** The sent screen encode latency. */\n screenEncodeLatency = 'screenEncodeLatency',\n /** The sent screen latency. */\n screenSentLatency = 'screenSentLatency',\n /** The sent screen bandwidth quality limitation. */\n screenQualityLimitationBandwidth = 'screenQualityLimitationBandwidth',\n /** The sent screen cpu quality limitation. */\n screenQualityLimitationCpu = 'screenQualityLimitationCpu',\n /** The sent screen resolustion changes caused by quality limitation. */\n screenQualityLimitationResolutionChanges = 'screenQualityLimitationResolutionChanges',\n /** The sent screen active Simulcast spatial layers. */\n screenSentActiveEncodings = 'screenSentActiveEncodings',\n /** The sent screen bitrates. */\n screenSentBitrates = 'screenSentBitrates',\n /** The sent screen bytes. */\n screenSentBytes = 'screenSentBytes',\n /** The sent screen packets. */\n screenSentPackets = 'screenSentPackets',\n /** The sent screen frames. */\n screenSentFrames = 'screenSentFrames',\n /** The sent screen framerate. */\n screenSentFps = 'screenSentFps',\n /** The sent screen width. */\n screenSentWidth = 'screenSentWidth',\n /** The sent screen height. */\n screenSentHeight = 'screenSentHeight',\n /** The sent screen encoding max bitrate. */\n screenSentMaxBitrate = 'screenSentMaxBitrate',\n //'screenSentPackets',\n /** The sent screen lost packets. */\n screenSentPacketsLost = 'screenSentPacketsLost',\n //'screenSentPacketsLostCount',\n /** The NACK count received by screen sender. */\n screenSentNackCountRecv = 'screenSentNackCountRecv',\n /** The sent screen round trip time. */\n screenSentRoundTripTime = 'screenSentRoundTripTime',\n /** The transport sent screen round trip time. */\n screenSentTransportRoundTripTime = 'screenSentTransportRoundTripTime',\n /** The screen sent jitter. */\n screenSentJitter = 'screenSentJitter',\n /** The screen audio RTX packets. */\n screenSentRetransmittedPackets = 'screenSentRetransmittedPackets',\n\n // inbound audio,\n audioRecvCodec = 'audioRecvCodec',\n audioRecvBytes = 'audioRecvBytes',\n audioRecvAvgJitterBufferDelay = 'audioRecvAvgJitterBufferDelay',\n audioRecvBitrates = 'audioRecvBitrates',\n audioRecvJitter = 'audioRecvJitter',\n audioRecvRoundTripTime = 'audioRecvRoundTripTime',\n audioRecvPackets = 'audioRecvPackets',\n audioRecvPacketsLost = 'audioRecvPacketsLost', // TODO: remove this.\n audioRecvLostPackets = 'audioRecvLostPackets',\n audioRecvPacketsLossRate = 'audioRecvPacketsLossRate',\n audioRecvRetransmittedPackets = 'audioRecvRetransmittedPackets',\n audioRecvNackCountSent = 'audioRecvNackCountSent',\n audioRecvLevel = 'audioRecvLevel',\n audioRecvTotalSamplesReceived = 'audioRecvTotalSamplesReceived',\n audioRecvConcealedSamples = 'audioRecvConcealedSamples',\n audioRecvConcealmentEvents = 'audioRecvConcealmentEvents',\n audioRecvInsertedSamplesForDeceleration = 'audioRecvInsertedSamplesForDeceleration',\n audioRecvRemovedSamplesForAcceleration = 'audioRecvRemovedSamplesForAcceleration',\n audioRecvEndToEndDelay = 'audioRecvEndToEndDelay',\n // inbound video,\n videoRecvCodec = 'videoRecvCodec',\n videoFirCountSent = 'videoFirCountSent',\n videoPliCountSent = 'videoPliCountSent',\n videoDecodeLatency = 'videoDecodeLatency',\n //'videoFramesDecoded',\n videoRecvFrames = 'videoRecvFrames',\n videoRecvFps = 'videoRecvFps',\n videoRecvAvgJitterBufferDelay = 'videoRecvAvgJitterBufferDelay',\n videoRecvBitrates = 'videoRecvBitrates',\n videoRecvBytes = 'videoRecvBytes',\n videoRecvHeight = 'videoRecvHeight',\n videoRecvJitter = 'videoRecvJitter',\n videoRecvRoundTripTime = 'videoRecvRoundTripTime',\n videoRecvPackets = 'videoRecvPackets',\n videoRecvLostPackets = 'videoRecvLostPackets',\n videoRecvPacketsLost = 'videoRecvPacketsLost', // TODO: remove this.\n videoRecvPacketsLossRate = 'videoRecvPacketsLossRate',\n videoRecvRetransmittedPackets = 'videoRecvRetransmittedPackets',\n videoRecvNackCountSent = 'videoRecvNackCountSent',\n videoRecvWidth = 'videoRecvWidth',\n videoRecvFrameRate = 'videoRecvFrameRate',\n //'videoTotalDecodeTime',\n videoTotalFreezesDuration = 'videoTotalFreezesDuration',\n videoRecvEndToEndDelay = 'videoRecvEndToEndDelay',\n // inbound screen,\n screenRecvCodec = 'screenRecvCodec',\n screenFirCountSent = 'screenFirCountSent',\n screenPliCountSent = 'screenPliCountSent',\n screenDecodeLatency = 'screenDecodeLatency',\n //'screenFramesDecoded',\n screenRecvFrames = 'screenRecvFrames',\n screenRecvFps = 'screenRecvFps',\n screenRecvAvgJitterBufferDelay = 'screenRecvAvgJitterBufferDelay',\n screenRecvBitrates = 'screenRecvBitrates',\n screenRecvBytes = 'screenRecvBytes',\n screenRecvHeight = 'screenRecvHeight',\n screenRecvJitter = 'screenRecvJitter',\n screenRecvRoundTripTime = 'screenRecvRoundTripTime',\n screenRecvPackets = 'screenRecvPackets',\n screenRecvLostPackets = 'screenRecvLostPackets',\n screenRecvPacketsLost = 'screenRecvPacketsLost', // TODO: remove this.\n screenRecvPacketsLossRate = 'screenRecvPacketsLossRate',\n screenRecvRetransmittedPackets = 'screenRecvRetransmittedPackets',\n screenRecvNackCountSent = 'screenRecvNackCountSent',\n screenRecvWidth = 'screenRecvWidth',\n screenRecvFrameRate = 'screenRecvFrameRate',\n //'screenTotalDecodeTime',\n screenTotalFreezesDuration = 'screenTotalFreezesDuration',\n screenRecvEndToEndDelay = 'screenRecvEndToEndDelay',\n /** The transport availableOutgoingBitrate stat. */\n transportSentAvailableOutgoingBitrate = 'transportSentAvailableOutgoingBitrate',\n}\n\n/**\n * The RTC stats collection indexed by {@link RtcStatsMetricNames}.\n *\n * Each {@link RtcStatsMetricNames} record points to an object indexed by\n * `trackId:hostName:codec`, where:\n * - `trackId`: The RTC getStats track identifier.\n * - `hostName`: The remote endpoint IP address or hostname.\n * - `codec`: The track codec.\n */\nexport type RtcStats = Record<RtcStatsMetricNames, Record<string, number | string>>\n\nconst RtcStatsMetrics = Object.keys(RtcStatsMetricNames)\n\nfunction setStats(stats: RtcStats, name: RtcStatsMetricNames, key: string, value?: number | string): void {\n assert(RtcStatsMetrics.includes(name), `Unknown stat name: ${name}`)\n if (value === undefined) return\n if (!stats[name]) {\n stats[name] = {}\n }\n stats[name][key] = value\n}\n\nexport function rtcStatKey({\n pageIndex,\n trackId,\n hostName,\n codec,\n participantName,\n}: {\n pageIndex?: number\n trackId?: string\n hostName?: string\n codec?: string\n participantName?: string\n}): string {\n return [pageIndex ?? '', participantName || '', hostName || 'unknown', codec || '', trackId || ''].join(':')\n}\n\nexport function parseRtStatKey(key: string): {\n pageIndex?: number\n trackId?: string\n hostName: string\n codec?: string\n participantName?: string\n} {\n const [pageIndex, participantName, hostName, codec, trackId] = key.split(':', 5)\n return {\n pageIndex: pageIndex ? parseInt(pageIndex) : undefined,\n trackId: trackId || undefined,\n hostName: hostName || 'unknown',\n codec: codec || undefined,\n participantName: participantName || undefined,\n }\n}\n\n/**\n * Updates the {@link RtcStats} object with the collected track values.\n */\nexport function updateRtcStats(\n stats: RtcStats,\n pageIndex: number,\n trackId: string,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n value: any,\n signalingHost?: string,\n participantName?: string,\n): void {\n const {\n enabled,\n inboundRtp,\n outboundRtp,\n remoteAddress,\n videoSentActiveEncodings,\n sentMaxBitrate,\n isDisplay,\n codec,\n availableOutgoingBitrate,\n } = value\n const hostName = signalingHost || remoteAddress\n const key = rtcStatKey({\n pageIndex,\n trackId,\n hostName,\n codec,\n participantName,\n })\n //log.log(`updateRtcStats`, {enabled, signalingHost, remoteAddress, isDisplay, key})\n // inbound\n if (inboundRtp) {\n const prefix = inboundRtp.kind === 'video' ? (isDisplay ? 'screen' : 'video') : 'audio'\n setStats(stats, (prefix + 'RecvCodec') as RtcStatsMetricNames, key, codec)\n if (enabled) {\n setStats(stats, (prefix + 'RecvAvgJitterBufferDelay') as RtcStatsMetricNames, key, inboundRtp.jitterBuffer)\n setStats(stats, (prefix + 'RecvBitrates') as RtcStatsMetricNames, key, inboundRtp.bitrate)\n setStats(stats, (prefix + 'RecvBytes') as RtcStatsMetricNames, key, inboundRtp.bytesReceived)\n setStats(stats, (prefix + 'RecvJitter') as RtcStatsMetricNames, key, inboundRtp.jitter)\n setStats(stats, (prefix + 'RecvRoundTripTime') as RtcStatsMetricNames, key, inboundRtp.transportRoundTripTime)\n setStats(stats, (prefix + 'RecvPackets') as RtcStatsMetricNames, key, inboundRtp.packetsReceived)\n setStats(\n stats,\n (prefix + 'RecvRetransmittedPackets') as RtcStatsMetricNames,\n key,\n inboundRtp.retransmittedPacketsReceived,\n )\n // TODO: remove this.\n setStats(stats, (prefix + 'RecvPacketsLost') as RtcStatsMetricNames, key, inboundRtp.packetsLossRate)\n setStats(stats, (prefix + 'RecvPacketsLossRate') as RtcStatsMetricNames, key, inboundRtp.packetsLossRate)\n setStats(stats, (prefix + 'RecvLostPackets') as RtcStatsMetricNames, key, inboundRtp.packetsLost)\n setStats(stats, (prefix + 'RecvNackCountSent') as RtcStatsMetricNames, key, inboundRtp.nackCount)\n setStats(stats, (prefix + 'RecvEndToEndDelay') as RtcStatsMetricNames, key, inboundRtp.endToEndDelay)\n if (inboundRtp.kind === 'audio') {\n ;[\n 'audioLevel',\n 'totalSamplesReceived',\n 'concealedSamples',\n 'concealmentEvents',\n 'insertedSamplesForDeceleration',\n 'removedSamplesForAcceleration',\n ].forEach(name => {\n setStats(\n stats,\n (prefix + 'Recv' + toTitleCase(name.replace('audio', ''))) as RtcStatsMetricNames,\n key,\n inboundRtp[name],\n )\n })\n }\n if (inboundRtp.kind === 'video' && inboundRtp.keyFramesDecoded > 0) {\n //setStats(stats, prefix + 'FramesDecoded', key, inboundRtp.framesDecoded\n setStats(stats, (prefix + 'RecvFrames') as RtcStatsMetricNames, key, inboundRtp.framesReceived)\n setStats(stats, (prefix + 'RecvFps') as RtcStatsMetricNames, key, inboundRtp.framesPerSecond)\n setStats(stats, (prefix + 'RecvHeight') as RtcStatsMetricNames, key, inboundRtp.frameHeight)\n setStats(stats, (prefix + 'RecvWidth') as RtcStatsMetricNames, key, inboundRtp.frameWidth)\n setStats(stats, (prefix + 'RecvFrameRate') as RtcStatsMetricNames, key, inboundRtp.frameRate)\n //setStats(stats, prefix + 'TotalDecodeTime', key, inboundRtp.totalDecodeTime)\n setStats(stats, (prefix + 'FirCountSent') as RtcStatsMetricNames, key, inboundRtp.firCount)\n setStats(stats, (prefix + 'PliCountSent') as RtcStatsMetricNames, key, inboundRtp.pliCount)\n setStats(stats, (prefix + 'DecodeLatency') as RtcStatsMetricNames, key, inboundRtp.decodeLatency)\n setStats(stats, (prefix + 'TotalFreezesDuration') as RtcStatsMetricNames, key, inboundRtp.totalFreezesDuration)\n }\n }\n }\n // outbound\n if (outboundRtp) {\n // log.log('outboundRtp', isDisplay, JSON.stringify(outboundRtp, null, 2));\n const prefix = outboundRtp.kind === 'video' ? (isDisplay ? 'screen' : 'video') : 'audio'\n setStats(stats, (prefix + 'SentCodec') as RtcStatsMetricNames, key, codec)\n if (enabled) {\n setStats(stats, (prefix + 'SentBitrates') as RtcStatsMetricNames, key, outboundRtp.bitrate)\n setStats(\n stats,\n (prefix + 'SentBytes') as RtcStatsMetricNames,\n key,\n outboundRtp.bytesSent + outboundRtp.headerBytesSent,\n )\n setStats(stats, (prefix + 'SentPackets') as RtcStatsMetricNames, key, outboundRtp.packetsSent)\n setStats(stats, (prefix + 'SentPacketsLost') as RtcStatsMetricNames, key, outboundRtp.packetsLossRate)\n setStats(stats, (prefix + 'SentNackCountRecv') as RtcStatsMetricNames, key, outboundRtp.nackCount)\n //setStats(stats, prefix + 'SentPacketsLostCount', key, outboundRtp.packetsLost)\n setStats(stats, (prefix + 'SentRoundTripTime') as RtcStatsMetricNames, key, outboundRtp.roundTripTime)\n setStats(stats, (prefix + 'SentJitter') as RtcStatsMetricNames, key, outboundRtp.jitter)\n setStats(\n stats,\n (prefix + 'SentTransportRoundTripTime') as RtcStatsMetricNames,\n key,\n outboundRtp.transportRoundTripTime,\n )\n setStats(stats, 'transportSentAvailableOutgoingBitrate' as RtcStatsMetricNames, key, availableOutgoingBitrate)\n setStats(stats, (prefix + 'SentMaxBitrate') as RtcStatsMetricNames, key, sentMaxBitrate)\n setStats(\n stats,\n (prefix + 'SentRetransmittedPackets') as RtcStatsMetricNames,\n key,\n outboundRtp.retransmittedPacketsSent,\n )\n if (outboundRtp.kind === 'video') {\n setStats(stats, (prefix + 'SentActiveEncodings') as RtcStatsMetricNames, key, videoSentActiveEncodings)\n setStats(\n stats,\n (prefix + 'QualityLimitationResolutionChanges') as RtcStatsMetricNames,\n key,\n outboundRtp.qualityLimitationResolutionChanges,\n )\n setStats(stats, (prefix + 'QualityLimitationCpu') as RtcStatsMetricNames, key, outboundRtp.qualityLimitationCpu)\n setStats(\n stats,\n (prefix + 'QualityLimitationBandwidth') as RtcStatsMetricNames,\n key,\n outboundRtp.qualityLimitationBandwidth,\n )\n setStats(stats, (prefix + 'SentWidth') as RtcStatsMetricNames, key, outboundRtp.frameWidth)\n setStats(stats, (prefix + 'SentHeight') as RtcStatsMetricNames, key, outboundRtp.frameHeight)\n setStats(stats, (prefix + 'SentFrames') as RtcStatsMetricNames, key, outboundRtp.framesSent)\n setStats(stats, (prefix + 'SentFps') as RtcStatsMetricNames, key, outboundRtp.framesPerSecond)\n setStats(stats, (prefix + 'FirCountReceived') as RtcStatsMetricNames, key, outboundRtp.firCountReceived)\n setStats(stats, (prefix + 'PliCountReceived') as RtcStatsMetricNames, key, outboundRtp.pliCountReceived)\n setStats(stats, (prefix + 'EncodeLatency') as RtcStatsMetricNames, key, outboundRtp.encodeLatency)\n setStats(stats, (prefix + 'SentLatency') as RtcStatsMetricNames, key, outboundRtp.sentLatency)\n }\n }\n }\n}\n"]}
1
+ {"version":3,"file":"rtcstats.js","sourceRoot":"","sources":["../../src/rtcstats.ts"],"names":[],"mappings":";;;;;;AA+UA,gCAcC;AAED,wCAeC;AAKD,wCAgJC;AAngBD,oDAA2B;AAE3B,mCAAqC;AAErC;;GAEG;AACH,IAAY,cAqGX;AArGD,WAAY,cAAc;IACxB,kDAAkD;IAClD,6BAAW,CAAA;IACX,qDAAqD;IACrD,mCAAiB,CAAA;IACjB,iCAAiC;IACjC,qCAAmB,CAAA;IACnB,oCAAoC;IACpC,2CAAyB,CAAA;IACzB,kCAAkC;IAClC,qCAAmB,CAAA;IACnB,qCAAqC;IACrC,2CAAyB,CAAA;IACzB,kCAAkC;IAClC,qCAAmB,CAAA;IACnB,0BAA0B;IAC1B,qCAAmB,CAAA;IACnB,6BAA6B;IAC7B,2CAAyB,CAAA;IAEzB,8BAA8B;IAC9B,iCAAe,CAAA;IACf,0CAA0C;IAC1C,qDAAmC,CAAA;IACnC,sDAAsD;IACtD,+EAA6D,CAAA;IAC7D,0DAA0D;IAC1D,qFAAmE,CAAA;IACnE,yCAAyC;IACzC,mEAAiD,CAAA;IACjD,2CAA2C;IAC3C,uEAAqD,CAAA;IACrD,wCAAwC;IACxC,iEAA+C,CAAA;IAC/C,8CAA8C;IAC9C,6EAA2D,CAAA;IAC3D,wCAAwC;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,CAAC,UAAU,CAAC,CAAA;gBAC5F,QAAQ,CAAC,KAAK,EAAE,CAAC,MAAM,GAAG,SAAS,CAAwB,EAAE,GAAG,EAAE,WAAW,CAAC,eAAe,CAAC,CAAA;gBAC9F,QAAQ,CAAC,KAAK,EAAE,CAAC,MAAM,GAAG,kBAAkB,CAAwB,EAAE,GAAG,EAAE,WAAW,CAAC,gBAAgB,CAAC,CAAA;gBACxG,QAAQ,CAAC,KAAK,EAAE,CAAC,MAAM,GAAG,kBAAkB,CAAwB,EAAE,GAAG,EAAE,WAAW,CAAC,gBAAgB,CAAC,CAAA;gBACxG,QAAQ,CAAC,KAAK,EAAE,CAAC,MAAM,GAAG,eAAe,CAAwB,EAAE,GAAG,EAAE,WAAW,CAAC,aAAa,CAAC,CAAA;gBAClG,QAAQ,CAAC,KAAK,EAAE,CAAC,MAAM,GAAG,aAAa,CAAwB,EAAE,GAAG,EAAE,WAAW,CAAC,WAAW,CAAC,CAAA;YAChG,CAAC;QACH,CAAC;IACH,CAAC;AACH,CAAC","sourcesContent":["import assert from 'assert'\n\nimport { toTitleCase } from './utils'\n\n/**\n * Page stats metric names.\n */\nexport enum PageStatsNames {\n /** The browser processes CPU usage (per page). */\n cpu = 'cpu',\n /** The browser processes memory usage (per page). */\n memory = 'memory',\n /** The tool nodejs CPU usage. */\n nodeCpu = 'nodeCpu',\n /** The tool nodejs memory usage. */\n nodeMemory = 'nodeMemory',\n /** The system total CPU usage. */\n usedCpu = 'usedCpu',\n /** The system total memory usage. */\n usedMemory = 'usedMemory',\n /** The system total GPU usage. */\n usedGpu = 'usedGpu',\n /** The page CPU usage. */\n pageCpu = 'pageCpu',\n /** The page memory usage. */\n pageMemory = 'pageMemory',\n\n /** The opened pages count. */\n pages = 'pages',\n /** The current opened PeerConnections. */\n peerConnections = 'peerConnections',\n /** The maximum PeerConnections connected duration. */\n peerConnectionConnectionTime = 'peerConnectionConnectionTime',\n /** The maximum PeerConnections disconnection duration. */\n peerConnectionDisconnectionTime = 'peerConnectionDisconnectionTime',\n /** The total created PeerConnections. */\n peerConnectionsCreated = 'peerConnectionsCreated',\n /** The total connected PeerConnections. */\n peerConnectionsConnected = 'peerConnectionsConnected',\n /** The total closed PeerConnections. */\n peerConnectionsClosed = 'peerConnectionsClosed',\n /** The total disconnected PeerConnections. */\n peerConnectionsDisconnected = 'peerConnectionsDisconnected',\n /** The total failed PeerConnections. */\n peerConnectionsFailed = 'peerConnectionsFailed',\n /** The total delay from PeerConnections creation to connection. */\n peerConnectionsDelay = 'peerConnectionsDelay',\n\n /** The page errors count. */\n errors = 'errors',\n /** The page warnings count. */\n warnings = 'warnings',\n\n /** The page total HTTP sent bytes. */\n httpSentBytes = 'httpSentBytes',\n /** The page total HTTP received bytes. */\n httpRecvBytes = 'httpRecvBytes',\n /** The page HTTP receive latency. */\n httpRecvLatency = 'httpRecvLatency',\n\n /** The page total WebSocket sent bytes. */\n wsSentBytes = 'wsSentBytes',\n /** The page total WebSocket received bytes. */\n wsRecvBytes = 'wsRecvBytes',\n /** The page WebSocket receive latency. */\n wsRecvLatency = 'wsRecvLatency',\n\n /** The audio end to end total delay. */\n audioEndToEndDelay = 'audioEndToEndDelay',\n /** The audio start frame delay. */\n audioStartFrameDelay = 'audioStartFrameDelay',\n\n /** The video end to end total delay. */\n videoEndToEndDelay = 'videoEndToEndDelay',\n /** The video start frame delay. */\n videoStartFrameDelay = 'videoStartFrameDelay',\n\n /** The screen end to end total delay. */\n screenEndToEndDelay = 'screenEndToEndDelay',\n /** The screen start frame delay. */\n screenStartFrameDelay = 'screenStartFrameDelay',\n\n cpuPressure = 'cpuPressure',\n\n videoWidth = 'videoWidth',\n videoHeight = 'videoHeight',\n videoBufferedTime = 'videoBufferedTime',\n videoPlayingTime = 'videoPlayingTime',\n videoBufferingTime = 'videoBufferingTime',\n videoBufferingEvents = 'videoBufferingEvents',\n\n /** The throttle upload rate limitation. */\n throttleUpRate = 'throttleUpRate',\n /** The throttle upload delay. */\n throttleUpDelay = 'throttleUpDelay',\n /** The throttle upload packet loss. */\n throttleUpLoss = 'throttleUpLoss',\n /** The throttle upload packet queue. */\n throttleUpQueue = 'throttleUpQueue',\n\n /** The throttle download rate limitation. */\n throttleDownRate = 'throttleDownRate',\n /** The throttle download delay. */\n throttleDownDelay = 'throttleDownDelay',\n /** The throttle download packet loss. */\n throttleDownLoss = 'throttleDownLoss',\n /** The throttle download packet queue. */\n throttleDownQueue = 'throttleDownQueue',\n}\n\n/**\n * RTC metrics collected by the page helper scripts and related to each\n * track object created by PeerConnections.\n */\nexport enum RtcStatsMetricNames {\n /** The sent audio codec. */\n audioSentCodec = 'audioSentCodec',\n /** The total sent audio bytes. */\n audioSentBytes = 'audioSentBytes',\n /** The sent audio packets. */\n audioSentPackets = 'audioSentPackets',\n /** The sent audio bitrates. */\n audioSentBitrates = 'audioSentBitrates',\n /** The send audio lost packets. */\n audioSentPacketsLost = 'audioSentPacketsLost',\n //'audioSentPacketsLostCount',\n /** The total audio NACK received by the sender. */\n audioSentNackCountRecv = 'audioSentNackCountRecv',\n /** The sent audio round trip time. */\n audioSentRoundTripTime = 'audioSentRoundTripTime',\n /** The sent audio jitter. */\n audioSentJitter = 'audioSentJitter',\n /** The audio RTC transport round trip time. */\n audioSentTransportRoundTripTime = 'audioSentTransportRoundTripTime',\n /** The sent audio encoding max bitrate. */\n audioSentMaxBitrate = 'audioSentMaxBitrate',\n /** The sent audio RTX packets. */\n audioSentRetransmittedPackets = 'audioSentRetransmittedPackets',\n\n /** The sent video codec. */\n videoSentCodec = 'videoSentCodec',\n /** The FIR requests received by the video sender. */\n videoFirCountReceived = 'videoFirCountReceived',\n /** The PLI requests received by the video sender. */\n videoPliCountReceived = 'videoPliCountReceived',\n /** The sent video encode latency. */\n videoEncodeLatency = 'videoEncodeLatency',\n /** The sent video latency. */\n videoSentLatency = 'videoSentLatency',\n /** The sent video bandwidth quality limitations. */\n videoQualityLimitationBandwidth = 'videoQualityLimitationBandwidth',\n /** The sent video cpu quality limitations. */\n videoQualityLimitationCpu = 'videoQualityLimitationCpu',\n /** The sent video total resolution changes for quality limitations. */\n videoQualityLimitationResolutionChanges = 'videoQualityLimitationResolutionChanges',\n /** The sent video Simulcast active spatial layers. */\n videoSentActiveEncodings = 'videoSentActiveEncodings',\n /** The sent video bitrates. */\n videoSentBitrates = 'videoSentBitrates',\n /** The sent video bytes. */\n videoSentBytes = 'videoSentBytes',\n /** The sent video packets. */\n videoSentPackets = 'videoSentPackets',\n /** The sent video frames. */\n videoSentFrames = 'videoSentFrames',\n /** The sent video framerate. */\n videoSentFps = 'videoSentFps',\n /** The sent video width. */\n videoSentWidth = 'videoSentWidth',\n /** The sent video height. */\n videoSentHeight = 'videoSentHeight',\n /** The sent video encoding max bitrate. */\n videoSentMaxBitrate = 'videoSentMaxBitrate',\n //'videoSentPackets',\n /** The sent video lost packets. */\n videoSentPacketsLost = 'videoSentPacketsLost',\n //'videoSentPacketsLostCount',\n /** The NACK count received by video sender. */\n videoSentNackCountRecv = 'videoSentNackCountRecv',\n /** The sent video round trip time. */\n videoSentRoundTripTime = 'videoSentRoundTripTime',\n /** The transport send video round trip time. */\n videoSentTransportRoundTripTime = 'videoSentTransportRoundTripTime',\n /** The video sent jitter. */\n videoSentJitter = 'videoSentJitter',\n /** The sent video RTX packets. */\n videoSentRetransmittedPackets = 'videoSentRetransmittedPackets',\n\n /** The sent screen codec. */\n screenSentCodec = 'screenSentCodec',\n /** The received FIR from screen sender. */\n screenFirCountReceived = 'screenFirCountReceived',\n /** The received PLI from screen sender. */\n screenPliCountReceived = 'screenPliCountReceived',\n /** The sent screen encode latency. */\n screenEncodeLatency = 'screenEncodeLatency',\n /** The sent screen latency. */\n screenSentLatency = 'screenSentLatency',\n /** The sent screen bandwidth quality limitation. */\n screenQualityLimitationBandwidth = 'screenQualityLimitationBandwidth',\n /** The sent screen cpu quality limitation. */\n screenQualityLimitationCpu = 'screenQualityLimitationCpu',\n /** The sent screen resolustion changes caused by quality limitation. */\n screenQualityLimitationResolutionChanges = 'screenQualityLimitationResolutionChanges',\n /** The sent screen active Simulcast spatial layers. */\n screenSentActiveEncodings = 'screenSentActiveEncodings',\n /** The sent screen bitrates. */\n screenSentBitrates = 'screenSentBitrates',\n /** The sent screen bytes. */\n screenSentBytes = 'screenSentBytes',\n /** The sent screen packets. */\n screenSentPackets = 'screenSentPackets',\n /** The sent screen frames. */\n screenSentFrames = 'screenSentFrames',\n /** The sent screen framerate. */\n screenSentFps = 'screenSentFps',\n /** The sent screen width. */\n screenSentWidth = 'screenSentWidth',\n /** The sent screen height. */\n screenSentHeight = 'screenSentHeight',\n /** The sent screen encoding max bitrate. */\n screenSentMaxBitrate = 'screenSentMaxBitrate',\n //'screenSentPackets',\n /** The sent screen lost packets. */\n screenSentPacketsLost = 'screenSentPacketsLost',\n //'screenSentPacketsLostCount',\n /** The NACK count received by screen sender. */\n screenSentNackCountRecv = 'screenSentNackCountRecv',\n /** The sent screen round trip time. */\n screenSentRoundTripTime = 'screenSentRoundTripTime',\n /** The transport sent screen round trip time. */\n screenSentTransportRoundTripTime = 'screenSentTransportRoundTripTime',\n /** The screen sent jitter. */\n screenSentJitter = 'screenSentJitter',\n /** The screen audio RTX packets. */\n screenSentRetransmittedPackets = 'screenSentRetransmittedPackets',\n\n // inbound audio,\n audioRecvCodec = 'audioRecvCodec',\n audioRecvBytes = 'audioRecvBytes',\n audioRecvAvgJitterBufferDelay = 'audioRecvAvgJitterBufferDelay',\n audioRecvBitrates = 'audioRecvBitrates',\n audioRecvJitter = 'audioRecvJitter',\n audioRecvRoundTripTime = 'audioRecvRoundTripTime',\n audioRecvPackets = 'audioRecvPackets',\n audioRecvPacketsLost = 'audioRecvPacketsLost', // TODO: remove this.\n audioRecvLostPackets = 'audioRecvLostPackets',\n audioRecvPacketsLossRate = 'audioRecvPacketsLossRate',\n audioRecvRetransmittedPackets = 'audioRecvRetransmittedPackets',\n audioRecvNackCountSent = 'audioRecvNackCountSent',\n audioRecvLevel = 'audioRecvLevel',\n audioRecvTotalSamplesReceived = 'audioRecvTotalSamplesReceived',\n audioRecvConcealedSamples = 'audioRecvConcealedSamples',\n audioRecvConcealmentEvents = 'audioRecvConcealmentEvents',\n audioRecvInsertedSamplesForDeceleration = 'audioRecvInsertedSamplesForDeceleration',\n audioRecvRemovedSamplesForAcceleration = 'audioRecvRemovedSamplesForAcceleration',\n audioRecvEndToEndDelay = 'audioRecvEndToEndDelay',\n // inbound video,\n videoRecvCodec = 'videoRecvCodec',\n videoFirCountSent = 'videoFirCountSent',\n videoPliCountSent = 'videoPliCountSent',\n videoDecodeLatency = 'videoDecodeLatency',\n videoFramesDecoded = 'videoFramesDecoded',\n videoFramesDropped = 'videoFramesDropped',\n videoRecvFrames = 'videoRecvFrames',\n videoRecvFps = 'videoRecvFps',\n videoRecvAvgJitterBufferDelay = 'videoRecvAvgJitterBufferDelay',\n videoRecvBitrates = 'videoRecvBitrates',\n videoRecvBytes = 'videoRecvBytes',\n videoRecvHeight = 'videoRecvHeight',\n videoRecvJitter = 'videoRecvJitter',\n videoRecvRoundTripTime = 'videoRecvRoundTripTime',\n videoRecvPackets = 'videoRecvPackets',\n videoRecvLostPackets = 'videoRecvLostPackets',\n videoRecvPacketsLost = 'videoRecvPacketsLost', // TODO: remove this.\n videoRecvPacketsLossRate = 'videoRecvPacketsLossRate',\n videoRecvRetransmittedPackets = 'videoRecvRetransmittedPackets',\n videoRecvNackCountSent = 'videoRecvNackCountSent',\n videoRecvWidth = 'videoRecvWidth',\n videoRecvFrameRate = 'videoRecvFrameRate',\n //'videoTotalDecodeTime',\n videoTotalFreezesDuration = 'videoTotalFreezesDuration',\n videoRecvEndToEndDelay = 'videoRecvEndToEndDelay',\n // inbound screen,\n screenRecvCodec = 'screenRecvCodec',\n screenFirCountSent = 'screenFirCountSent',\n screenPliCountSent = 'screenPliCountSent',\n screenDecodeLatency = 'screenDecodeLatency',\n screenFramesDecoded = 'screenFramesDecoded',\n screenFramesDropped = 'screenFramesDropped',\n screenRecvFrames = 'screenRecvFrames',\n screenRecvFps = 'screenRecvFps',\n screenRecvAvgJitterBufferDelay = 'screenRecvAvgJitterBufferDelay',\n screenRecvBitrates = 'screenRecvBitrates',\n screenRecvBytes = 'screenRecvBytes',\n screenRecvHeight = 'screenRecvHeight',\n screenRecvJitter = 'screenRecvJitter',\n screenRecvRoundTripTime = 'screenRecvRoundTripTime',\n screenRecvPackets = 'screenRecvPackets',\n screenRecvLostPackets = 'screenRecvLostPackets',\n screenRecvPacketsLost = 'screenRecvPacketsLost', // TODO: remove this.\n screenRecvPacketsLossRate = 'screenRecvPacketsLossRate',\n screenRecvRetransmittedPackets = 'screenRecvRetransmittedPackets',\n screenRecvNackCountSent = 'screenRecvNackCountSent',\n screenRecvWidth = 'screenRecvWidth',\n screenRecvFrameRate = 'screenRecvFrameRate',\n //'screenTotalDecodeTime',\n screenTotalFreezesDuration = 'screenTotalFreezesDuration',\n screenRecvEndToEndDelay = 'screenRecvEndToEndDelay',\n /** The transport availableOutgoingBitrate stat. */\n transportSentAvailableOutgoingBitrate = 'transportSentAvailableOutgoingBitrate',\n}\n\n/**\n * The RTC stats collection indexed by {@link RtcStatsMetricNames}.\n *\n * Each {@link RtcStatsMetricNames} record points to an object indexed by\n * `trackId:hostName:codec`, where:\n * - `trackId`: The RTC getStats track identifier.\n * - `hostName`: The remote endpoint IP address or hostname.\n * - `codec`: The track codec.\n */\nexport type RtcStats = Record<RtcStatsMetricNames, Record<string, number | string>>\n\nconst RtcStatsMetrics = Object.keys(RtcStatsMetricNames)\n\nfunction setStats(stats: RtcStats, name: RtcStatsMetricNames, key: string, value?: number | string): void {\n assert(RtcStatsMetrics.includes(name), `Unknown stat name: ${name}`)\n if (value === undefined) return\n if (!stats[name]) {\n stats[name] = {}\n }\n stats[name][key] = value\n}\n\nexport function rtcStatKey({\n pageIndex,\n trackId,\n hostName,\n codec,\n participantName,\n}: {\n pageIndex?: number\n trackId?: string\n hostName?: string\n codec?: string\n participantName?: string\n}): string {\n return [pageIndex ?? '', participantName || '', hostName || 'unknown', codec || '', trackId || ''].join(':')\n}\n\nexport function parseRtStatKey(key: string): {\n pageIndex?: number\n trackId?: string\n hostName: string\n codec?: string\n participantName?: string\n} {\n const [pageIndex, participantName, hostName, codec, trackId] = key.split(':', 5)\n return {\n pageIndex: pageIndex ? parseInt(pageIndex) : undefined,\n trackId: trackId || undefined,\n hostName: hostName || 'unknown',\n codec: codec || undefined,\n participantName: participantName || undefined,\n }\n}\n\n/**\n * Updates the {@link RtcStats} object with the collected track values.\n */\nexport function updateRtcStats(\n stats: RtcStats,\n pageIndex: number,\n trackId: string,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n value: any,\n signalingHost?: string,\n participantName?: string,\n): void {\n const {\n enabled,\n inboundRtp,\n outboundRtp,\n remoteAddress,\n videoSentActiveEncodings,\n sentMaxBitrate,\n isDisplay,\n codec,\n availableOutgoingBitrate,\n } = value\n const hostName = signalingHost || remoteAddress\n const key = rtcStatKey({\n pageIndex,\n trackId,\n hostName,\n codec,\n participantName,\n })\n //log.log(`updateRtcStats`, {enabled, signalingHost, remoteAddress, isDisplay, key})\n // inbound\n if (inboundRtp) {\n const prefix = inboundRtp.kind === 'video' ? (isDisplay ? 'screen' : 'video') : 'audio'\n setStats(stats, (prefix + 'RecvCodec') as RtcStatsMetricNames, key, codec)\n if (enabled) {\n setStats(stats, (prefix + 'RecvAvgJitterBufferDelay') as RtcStatsMetricNames, key, inboundRtp.jitterBuffer)\n setStats(stats, (prefix + 'RecvBitrates') as RtcStatsMetricNames, key, inboundRtp.bitrate)\n setStats(stats, (prefix + 'RecvBytes') as RtcStatsMetricNames, key, inboundRtp.bytesReceived)\n setStats(stats, (prefix + 'RecvJitter') as RtcStatsMetricNames, key, inboundRtp.jitter)\n setStats(stats, (prefix + 'RecvRoundTripTime') as RtcStatsMetricNames, key, inboundRtp.transportRoundTripTime)\n setStats(stats, (prefix + 'RecvPackets') as RtcStatsMetricNames, key, inboundRtp.packetsReceived)\n setStats(\n stats,\n (prefix + 'RecvRetransmittedPackets') as RtcStatsMetricNames,\n key,\n inboundRtp.retransmittedPacketsReceived,\n )\n // TODO: remove this.\n setStats(stats, (prefix + 'RecvPacketsLost') as RtcStatsMetricNames, key, inboundRtp.packetsLossRate)\n setStats(stats, (prefix + 'RecvPacketsLossRate') as RtcStatsMetricNames, key, inboundRtp.packetsLossRate)\n setStats(stats, (prefix + 'RecvLostPackets') as RtcStatsMetricNames, key, inboundRtp.packetsLost)\n setStats(stats, (prefix + 'RecvNackCountSent') as RtcStatsMetricNames, key, inboundRtp.nackCount)\n setStats(stats, (prefix + 'RecvEndToEndDelay') as RtcStatsMetricNames, key, inboundRtp.endToEndDelay)\n if (inboundRtp.kind === 'audio') {\n ;[\n 'audioLevel',\n 'totalSamplesReceived',\n 'concealedSamples',\n 'concealmentEvents',\n 'insertedSamplesForDeceleration',\n 'removedSamplesForAcceleration',\n ].forEach(name => {\n setStats(\n stats,\n (prefix + 'Recv' + toTitleCase(name.replace('audio', ''))) as RtcStatsMetricNames,\n key,\n inboundRtp[name],\n )\n })\n }\n if (inboundRtp.kind === 'video' && inboundRtp.keyFramesDecoded > 0) {\n setStats(stats, (prefix + 'FramesDecoded') as RtcStatsMetricNames, key, inboundRtp.framesDecoded)\n setStats(stats, (prefix + 'FramesDropped') as RtcStatsMetricNames, key, inboundRtp.framesDropped)\n setStats(stats, (prefix + 'RecvFrames') as RtcStatsMetricNames, key, inboundRtp.framesReceived)\n setStats(stats, (prefix + 'RecvFps') as RtcStatsMetricNames, key, inboundRtp.framesPerSecond)\n setStats(stats, (prefix + 'RecvHeight') as RtcStatsMetricNames, key, inboundRtp.frameHeight)\n setStats(stats, (prefix + 'RecvWidth') as RtcStatsMetricNames, key, inboundRtp.frameWidth)\n setStats(stats, (prefix + 'RecvFrameRate') as RtcStatsMetricNames, key, inboundRtp.frameRate)\n //setStats(stats, prefix + 'TotalDecodeTime', key, inboundRtp.totalDecodeTime)\n setStats(stats, (prefix + 'FirCountSent') as RtcStatsMetricNames, key, inboundRtp.firCount)\n setStats(stats, (prefix + 'PliCountSent') as RtcStatsMetricNames, key, inboundRtp.pliCount)\n setStats(stats, (prefix + 'DecodeLatency') as RtcStatsMetricNames, key, inboundRtp.decodeLatency)\n setStats(stats, (prefix + 'TotalFreezesDuration') as RtcStatsMetricNames, key, inboundRtp.totalFreezesDuration)\n }\n }\n }\n // outbound\n if (outboundRtp) {\n // log.log('outboundRtp', isDisplay, JSON.stringify(outboundRtp, null, 2));\n const prefix = outboundRtp.kind === 'video' ? (isDisplay ? 'screen' : 'video') : 'audio'\n setStats(stats, (prefix + 'SentCodec') as RtcStatsMetricNames, key, codec)\n if (enabled) {\n setStats(stats, (prefix + 'SentBitrates') as RtcStatsMetricNames, key, outboundRtp.bitrate)\n setStats(\n stats,\n (prefix + 'SentBytes') as RtcStatsMetricNames,\n key,\n outboundRtp.bytesSent + outboundRtp.headerBytesSent,\n )\n setStats(stats, (prefix + 'SentPackets') as RtcStatsMetricNames, key, outboundRtp.packetsSent)\n setStats(stats, (prefix + 'SentPacketsLost') as RtcStatsMetricNames, key, outboundRtp.packetsLossRate)\n setStats(stats, (prefix + 'SentNackCountRecv') as RtcStatsMetricNames, key, outboundRtp.nackCount)\n //setStats(stats, prefix + 'SentPacketsLostCount', key, outboundRtp.packetsLost)\n setStats(stats, (prefix + 'SentRoundTripTime') as RtcStatsMetricNames, key, outboundRtp.roundTripTime)\n setStats(stats, (prefix + 'SentJitter') as RtcStatsMetricNames, key, outboundRtp.jitter)\n setStats(\n stats,\n (prefix + 'SentTransportRoundTripTime') as RtcStatsMetricNames,\n key,\n outboundRtp.transportRoundTripTime,\n )\n setStats(stats, 'transportSentAvailableOutgoingBitrate' as RtcStatsMetricNames, key, availableOutgoingBitrate)\n setStats(stats, (prefix + 'SentMaxBitrate') as RtcStatsMetricNames, key, sentMaxBitrate)\n setStats(\n stats,\n (prefix + 'SentRetransmittedPackets') as RtcStatsMetricNames,\n key,\n outboundRtp.retransmittedPacketsSent,\n )\n if (outboundRtp.kind === 'video') {\n setStats(stats, (prefix + 'SentActiveEncodings') as RtcStatsMetricNames, key, videoSentActiveEncodings)\n setStats(\n stats,\n (prefix + 'QualityLimitationResolutionChanges') as RtcStatsMetricNames,\n key,\n outboundRtp.qualityLimitationResolutionChanges,\n )\n setStats(stats, (prefix + 'QualityLimitationCpu') as RtcStatsMetricNames, key, outboundRtp.qualityLimitationCpu)\n setStats(\n stats,\n (prefix + 'QualityLimitationBandwidth') as RtcStatsMetricNames,\n key,\n outboundRtp.qualityLimitationBandwidth,\n )\n setStats(stats, (prefix + 'SentWidth') as RtcStatsMetricNames, key, outboundRtp.frameWidth)\n setStats(stats, (prefix + 'SentHeight') as RtcStatsMetricNames, key, outboundRtp.frameHeight)\n setStats(stats, (prefix + 'SentFrames') as RtcStatsMetricNames, key, outboundRtp.framesSent)\n setStats(stats, (prefix + 'SentFps') as RtcStatsMetricNames, key, outboundRtp.framesPerSecond)\n setStats(stats, (prefix + 'FirCountReceived') as RtcStatsMetricNames, key, outboundRtp.firCountReceived)\n setStats(stats, (prefix + 'PliCountReceived') as RtcStatsMetricNames, key, outboundRtp.pliCountReceived)\n setStats(stats, (prefix + 'EncodeLatency') as RtcStatsMetricNames, key, outboundRtp.encodeLatency)\n setStats(stats, (prefix + 'SentLatency') as RtcStatsMetricNames, key, outboundRtp.sentLatency)\n }\n }\n }\n}\n"]}
@@ -78,7 +78,7 @@ export declare function twoParticipantsWithRateLossDelay(id: string, { rate, los
78
78
  loss: number;
79
79
  delay: number;
80
80
  direction: ThrottleDirection;
81
- }, repeat: 1): Promise<Partial<{
81
+ }, repeat?: number): Promise<Partial<{
82
82
  url: string;
83
83
  urlQuery: string;
84
84
  customUrlHandler: string;
@@ -119,6 +119,7 @@ export declare function twoParticipantsWithRateLossDelay(id: string, { rate, los
119
119
  pageLogFilter: string;
120
120
  pageLogPath: string;
121
121
  enableBrowserLogging: string;
122
+ enableRtpDump: string;
122
123
  userAgent: string;
123
124
  scriptPath: string;
124
125
  scriptParams: string;
@@ -240,7 +240,7 @@ async function plotStatsSummary(stats) {
240
240
  * @param repeat The number of times to repeat the test scenario. Default is 1.
241
241
  * @returns An array of partial configuration objects for each test scenario.
242
242
  */
243
- async function twoParticipantsWithRateLossDelay(id, { rate, loss, delay, direction }, repeat) {
243
+ async function twoParticipantsWithRateLossDelay(id, { rate, loss, delay, direction }, repeat = 1) {
244
244
  const throttle = {};
245
245
  const queue = 25;
246
246
  if (direction === 'down' || direction === 'bidi') {
@@ -1 +1 @@
1
- {"version":3,"file":"scenarios.js","sourceRoot":"","sources":["../../src/scenarios.ts"],"names":[],"mappings":";;;;;AAmBA,wCAcC;AAmBD,sDA8CC;AAUD,4DA6CC;AAID,sCAQC;AAED,gCAEC;AAED,kCAEC;AAED,gDASC;AAED,8CAQC;AAED,4CA0CC;AAoBD,4EAoDC;AAtTD,4CAAmB;AACnB,gDAAuB;AACvB,mCAAmC;AAGnC,2CAAyC;AACzC,mCAAgC;AAChC,2CAAoC;AACpC,iCAA2C;AAE3C,MAAM,GAAG,GAAG,IAAA,cAAM,EAAC,sBAAsB,CAAC,CAAA;AAI1C;;;;GAIG;AACI,KAAK,UAAU,cAAc,CAAC,QAAgB;IACnD,GAAG,CAAC,KAAK,CAAC,mBAAmB,QAAQ,EAAE,CAAC,CAAA;IACxC,MAAM,QAAQ,GAAG,MAAM,YAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAA;IAC9D,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;IAClC,MAAM,OAAO,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;IACnC,MAAM,IAAI,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CACrC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,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7B;oBACE,QAAQ;oBACR,QAAQ,EAAE,KAAK;oBACf,eAAe,EAAE,WAAW;oBAC5B,oBAAoB,EAAE,WAAW;oBACjC,GAAG,QAAQ;iBACZ;aACF,CAAC;SACH,CAAC,CAAA;IACJ,CAAC;IACD,OAAO,GAAG,CAAA;AACZ,CAAC","sourcesContent":["import fs from 'fs'\nimport path from 'path'\nimport { FastStats } from './stats'\nimport { ThrottleConfig, ThrottleRule } from '@vpalmisano/throttler'\nimport { Config } from './config'\nimport { Auth, google } from 'googleapis'\nimport { logger } from './utils'\nimport { sprintf } from 'sprintf-js'\nimport { PlotData, plotHtml } from './plot'\n\nconst log = logger('webrtcperf:scenarios')\n\nexport type StatsRow = Record<string, string | number>\n\n/**\n * It parses a CSV stats file and returns an array of objects representing each row.\n * @param filePath The path to the CSV stats file.\n * @returns An array of objects where each object represents a row in the CSV file with keys as column headers.\n */\nexport async function parseStatsFile(filePath: string) {\n log.debug(`parseStatsFile: ${filePath}`)\n const fileData = await fs.promises.readFile(filePath, 'utf-8')\n const lines = fileData.split('\\n')\n const headers = lines[0].split(',')\n const data = lines.slice(1).map(line =>\n line.split(',').reduce((acc, value, index) => {\n if (value !== '') {\n acc[headers[index]] = isNaN(Number(value)) ? value : Number(value)\n }\n return acc\n }, {} as StatsRow),\n )\n return data\n}\n\nexport type StatsSummary = {\n timestamp: number\n id: string\n scenario: string\n videoRecvBitratePerPixel: FastStats\n videoRecvFps: FastStats\n videoSentFps: FastStats\n}\n\n/**\n * It aggregates the stats summary from multiple test runs in a directory.\n * @param options.dirPath Directory path containing test run subdirectories. Default is 'logs'.\n * @param options.senderParticipantName Participant name of the sender. Default is 'Participant-000001'.\n * @param options.receiverParticipantName Participant name of the receiver. Default is 'Participant-000000'.\n * @param options.nameParser Function to parse test directory names. Default splits by '_' and extracts id and scenario.\n * @returns Array of aggregated stats including timestamp, id, scenario, videoRecvBitratePerPixel, videoRecvFps, and videoSentFps.\n */\nexport async function aggregateStatsSummary({\n dirPath = 'logs',\n senderParticipantName = 'Participant-000001',\n receiverParticipantName = 'Participant-000000',\n nameParser = (name: string) => {\n const [_, id, scenario] = name.split('_')\n return { id, scenario }\n },\n}) {\n log.debug(`aggregateStatsSummary: ${dirPath}`)\n const stats: StatsSummary[] = []\n const results = await fs.promises.readdir(dirPath)\n for (const test of results) {\n const filePath = path.join(dirPath, test, 'detailed-stats-summary.csv')\n if (!fs.existsSync(filePath)) continue\n const timestamp = fs.statSync(path.join(dirPath, test)).ctime.getTime()\n const data = await parseStatsFile(filePath)\n const { id, scenario } = nameParser(test)\n\n const aggregated = {\n timestamp,\n id,\n scenario,\n videoRecvBitratePerPixel: new FastStats(),\n videoRecvFps: new FastStats(),\n videoSentFps: new FastStats(),\n }\n data.forEach(v => {\n const { participantName, trackId } = v as { participantName: string; trackId: string }\n const metrics = v as Record<string, number>\n if (participantName === receiverParticipantName) {\n if (trackId?.endsWith('-v') && metrics.videoRecvFrames > 0) {\n const videoRecvBitratePerPixel =\n metrics.videoRecvBitrates / (metrics.videoRecvWidth * metrics.videoRecvHeight)\n if (!isNaN(videoRecvBitratePerPixel)) aggregated.videoRecvBitratePerPixel.push(videoRecvBitratePerPixel)\n if (!isNaN(metrics.videoRecvFps)) aggregated.videoRecvFps.push(metrics.videoRecvFps)\n }\n } else if (participantName === senderParticipantName) {\n if (trackId?.endsWith('-v') && metrics.videoSentFrames > 0) {\n if (!isNaN(metrics.videoSentFps)) aggregated.videoSentFps.push(metrics.videoSentFps)\n }\n }\n })\n stats.push(aggregated)\n }\n return stats.sort((a, b) => a.timestamp - b.timestamp)\n}\n\n/**\n * It uploads the aggregated stats to a Google Sheet.\n * A valid Google service account credentials file must be specified\n * in the `GOOGLE_CREDENTIALS_PATH` environment variable.\n * @param stats The aggregated stats to upload.\n * @param spreadsheetId The ID of the Google Spreadsheet.\n * @param table The name of the table (sheet) within the spreadsheet. Default is 'data'.\n */\nexport async function uploadStatsToGoogleSheet(stats: StatsSummary[], spreadsheetId: string, table = 'data') {\n log.debug(`uploadResultsToGoogleSheet spreadsheetId: ${spreadsheetId} table: ${table}`)\n if (!process.env.GOOGLE_CREDENTIALS_PATH) throw new Error('GOOGLE_CREDENTIALS_PATH environment variable is not set')\n if (!fs.existsSync(process.env.GOOGLE_CREDENTIALS_PATH))\n throw new Error(`Google credentials file not found: ${process.env.GOOGLE_CREDENTIALS_PATH}`)\n if (!stats.length) return\n const auth = new Auth.GoogleAuth({\n keyFile: process.env.GOOGLE_CREDENTIALS_PATH,\n scopes: ['https://www.googleapis.com/auth/spreadsheets'],\n })\n const sheets = google.sheets({ version: 'v4', auth })\n // Update headers.\n const headers = ['datetime', 'id', 'scenario', 'videoRecvBitratePerPixel', 'videoRecvFps']\n await sheets.spreadsheets.values.update({\n spreadsheetId,\n range: `${table}!A1:E1`,\n valueInputOption: 'USER_ENTERED',\n requestBody: { majorDimension: 'ROWS', values: [headers] },\n })\n // Append values.\n const values = [] as string[][]\n stats.forEach(s => {\n const { timestamp, id, scenario, videoRecvBitratePerPixel, videoRecvFps } = s\n if (!videoRecvBitratePerPixel.length) return\n const datetime = new Date(timestamp).toLocaleString('en-US', {\n timeZone: 'UTC',\n hourCycle: 'h23',\n })\n values.push([\n datetime,\n id,\n formatThrottleRule(parseThrottleRule(scenario), true),\n videoRecvBitratePerPixel.percentile(95).toFixed(3),\n videoRecvFps.percentile(95).toFixed(3),\n ])\n })\n if (values.length) {\n await sheets.spreadsheets.values.append({\n spreadsheetId,\n range: `${table}!A:E`,\n valueInputOption: 'USER_ENTERED',\n insertDataOption: 'INSERT_ROWS',\n requestBody: { majorDimension: 'ROWS', values },\n })\n }\n}\n\nexport type ThrottleDirection = 'up' | 'down' | 'bidi'\n\nexport function formatBitrate(bitrate: number | undefined, prefix = ' ', pad = true) {\n if (bitrate === undefined) return ''\n let suffix = 'Kbps'\n if (bitrate >= 1000) {\n bitrate /= 1000\n suffix = 'Mbps'\n }\n return `${prefix}${sprintf(`%${pad ? '5' : ''}.4g`, bitrate)}${suffix}`\n}\n\nexport function formatLoss(loss: number | undefined, prefix = ' ', pad = true) {\n return loss !== undefined ? `${prefix}${loss.toFixed(0).padStart(pad ? 2 : 0, ' ')}%` : ''\n}\n\nexport function formatDelay(delay: number | undefined, prefix = ' ', pad = true) {\n return delay !== undefined ? `${prefix}${delay.toFixed(0).padStart(pad ? 3 : 0, ' ')}ms` : ''\n}\n\nexport function formatThrottleRule(\n throttleRule: ThrottleRule & { direction: ThrottleDirection },\n human = false,\n pad = true,\n) {\n const { rate, loss, delay, direction } = throttleRule\n return human\n ? `${direction.padEnd(pad ? 4 : 0, ' ')}${formatBitrate(rate, ' ', pad)}${formatLoss(loss, ' ', pad)}${formatDelay(delay, ' ', pad)}`\n : `${direction}-r${rate}-l${loss}-d${delay}`\n}\n\nexport function parseThrottleRule(throttleDesc: string) {\n const match = throttleDesc.match(/(up|down|bidi)-r(\\d+)-l([\\d.]+)-d(\\d+)/)\n if (!match) throw new Error(`Invalid throttle description: ${throttleDesc}`)\n const direction = match[1] as ThrottleDirection\n const rate = parseInt(match[2])\n const loss = parseInt(match[3])\n const delay = parseInt(match[4])\n return { direction, rate, loss, delay }\n}\n\nexport async function plotStatsSummary(stats: StatsSummary[]) {\n const labels = new Set<string>()\n const data = {} as Record<string, Record<string, FastStats>>\n stats.forEach(s => {\n const { id, scenario, videoRecvBitratePerPixel } = s\n if (!videoRecvBitratePerPixel.length) return null\n if (!data[id]) {\n data[id] = {}\n }\n const scenarioFormatted = formatThrottleRule(parseThrottleRule(scenario), true, true)\n if (!data[id][scenarioFormatted]) {\n data[id][scenarioFormatted] = new FastStats()\n }\n labels.add(scenarioFormatted)\n data[id][scenarioFormatted].push(videoRecvBitratePerPixel.percentile(95))\n })\n const series: PlotData[] = []\n Object.entries(data)\n .sort((a, b) => a[0].localeCompare(b[0]))\n .forEach(([id, data]) => {\n const plotData: PlotData = { label: id, data: [] }\n Object.entries(data)\n .sort((a, b) => a[0].localeCompare(b[0]))\n .forEach(([scenario, stats]) => {\n plotData.data.push({\n x: scenario,\n y: stats.percentile(50),\n yMin: stats.percentile(5),\n yMax: stats.percentile(95),\n })\n })\n series.push(plotData)\n })\n await plotHtml(\n {\n type: 'barWithErrorBars',\n xLabel: 'Scenario',\n yLabel: 'Video Receive Bitrate per Pixel',\n labels: Array.from(labels).sort((a, b) => a.localeCompare(b)),\n },\n series,\n )\n}\n\n/**\n * It generates a test configuration with a scenario including 2 participants.\n * The first participant sends video and the second receives it.\n * Both participants send and receive audio.\n * The network conditions are applied according to the specified direction to the sender (`up`),\n * the receiver (`down`) or both (`bidi`).\n * The test is repeated the specified number of times.\n * The output is an array of partial configuration objects that can be used to run the tests\n * with the main application, after merging it with a configuration that includes\n * the destination url (mandatory) and other optional parameters.\n * @param id The unique identifier for the test scenario.\n * @param options.rate The target bandwidth in kbps.\n * @param options.loss The packet loss percentage.\n * @param options.delay The network delay in milliseconds.\n * @param options.direction The direction of the network throttling: 'up', 'down', or 'bidi'.\n * @param repeat The number of times to repeat the test scenario. Default is 1.\n * @returns An array of partial configuration objects for each test scenario.\n */\nexport async function twoParticipantsWithRateLossDelay(\n id: string,\n { rate, loss, delay, direction }: { rate: number; loss: number; delay: number; direction: ThrottleDirection },\n repeat: 1,\n) {\n const throttle: ThrottleConfig = {}\n const queue = 25\n if (direction === 'down' || direction === 'bidi') {\n throttle.down = [\n { rate: 20000, loss: 0, delay: 0, queue },\n { rate, loss, delay, queue, at: 30 },\n ]\n }\n if (direction === 'up' || direction === 'bidi') {\n throttle.up = [\n { rate: 20000, loss: 0, delay, queue },\n { rate, loss, delay, queue, at: 30 },\n ]\n }\n const throttleDesc = formatThrottleRule({ rate, loss, delay, direction })\n const now = Date.now()\n const ret: Partial<Config>[] = []\n for (let i = 0; i < repeat; i++) {\n const basePath = `logs/${now}-${i + 1}_${id}_${throttleDesc}`\n const sessions = direction === 'bidi' ? '0-1' : direction === 'down' ? '0' : '1'\n ret.push({\n sessions: 2,\n runDuration: 60 * 3,\n debuggingPort: 9000,\n prometheusPushgateway: 'http://localhost:9091',\n prometheusPushgatewayJobName: id,\n statsPath: `${basePath}/stats.csv`,\n detailedStatsPath: `${basePath}/detailed-stats.csv`,\n showPageLog: false,\n showStats: false,\n statsInterval: 5,\n scriptParams: JSON.stringify({\n enableMic: '0-1',\n enableCam: '1',\n }),\n throttleConfig: JSON.stringify([\n {\n sessions,\n protocol: 'udp',\n skipSourcePorts: '53,80,443',\n skipDestinationPorts: '53,80,443',\n ...throttle,\n },\n ]),\n })\n }\n return ret\n}\n"]}
1
+ {"version":3,"file":"scenarios.js","sourceRoot":"","sources":["../../src/scenarios.ts"],"names":[],"mappings":";;;;;AAmBA,wCAcC;AAmBD,sDA8CC;AAUD,4DA6CC;AAID,sCAQC;AAED,gCAEC;AAED,kCAEC;AAED,gDASC;AAED,8CAQC;AAED,4CA0CC;AAoBD,4EAoDC;AAtTD,4CAAmB;AACnB,gDAAuB;AACvB,mCAAmC;AAGnC,2CAAyC;AACzC,mCAAgC;AAChC,2CAAoC;AACpC,iCAA2C;AAE3C,MAAM,GAAG,GAAG,IAAA,cAAM,EAAC,sBAAsB,CAAC,CAAA;AAI1C;;;;GAIG;AACI,KAAK,UAAU,cAAc,CAAC,QAAgB;IACnD,GAAG,CAAC,KAAK,CAAC,mBAAmB,QAAQ,EAAE,CAAC,CAAA;IACxC,MAAM,QAAQ,GAAG,MAAM,YAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAA;IAC9D,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;IAClC,MAAM,OAAO,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;IACnC,MAAM,IAAI,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CACrC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,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S,CAAC;gBAC7B;oBACE,QAAQ;oBACR,QAAQ,EAAE,KAAK;oBACf,eAAe,EAAE,WAAW;oBAC5B,oBAAoB,EAAE,WAAW;oBACjC,GAAG,QAAQ;iBACZ;aACF,CAAC;SACH,CAAC,CAAA;IACJ,CAAC;IACD,OAAO,GAAG,CAAA;AACZ,CAAC","sourcesContent":["import fs from 'fs'\nimport path from 'path'\nimport { FastStats } from './stats'\nimport { ThrottleConfig, ThrottleRule } from '@vpalmisano/throttler'\nimport { Config } from './config'\nimport { Auth, google } from 'googleapis'\nimport { logger } from './utils'\nimport { sprintf } from 'sprintf-js'\nimport { PlotData, plotHtml } from './plot'\n\nconst log = logger('webrtcperf:scenarios')\n\nexport type StatsRow = Record<string, string | number>\n\n/**\n * It parses a CSV stats file and returns an array of objects representing each row.\n * @param filePath The path to the CSV stats file.\n * @returns An array of objects where each object represents a row in the CSV file with keys as column headers.\n */\nexport async function parseStatsFile(filePath: string) {\n log.debug(`parseStatsFile: ${filePath}`)\n const fileData = await fs.promises.readFile(filePath, 'utf-8')\n const lines = fileData.split('\\n')\n const headers = lines[0].split(',')\n const data = lines.slice(1).map(line =>\n line.split(',').reduce((acc, value, index) => {\n if (value !== '') {\n acc[headers[index]] = isNaN(Number(value)) ? value : Number(value)\n }\n return acc\n }, {} as StatsRow),\n )\n return data\n}\n\nexport type StatsSummary = {\n timestamp: number\n id: string\n scenario: string\n videoRecvBitratePerPixel: FastStats\n videoRecvFps: FastStats\n videoSentFps: FastStats\n}\n\n/**\n * It aggregates the stats summary from multiple test runs in a directory.\n * @param options.dirPath Directory path containing test run subdirectories. Default is 'logs'.\n * @param options.senderParticipantName Participant name of the sender. Default is 'Participant-000001'.\n * @param options.receiverParticipantName Participant name of the receiver. Default is 'Participant-000000'.\n * @param options.nameParser Function to parse test directory names. Default splits by '_' and extracts id and scenario.\n * @returns Array of aggregated stats including timestamp, id, scenario, videoRecvBitratePerPixel, videoRecvFps, and videoSentFps.\n */\nexport async function aggregateStatsSummary({\n dirPath = 'logs',\n senderParticipantName = 'Participant-000001',\n receiverParticipantName = 'Participant-000000',\n nameParser = (name: string) => {\n const [_, id, scenario] = name.split('_')\n return { id, scenario }\n },\n}) {\n log.debug(`aggregateStatsSummary: ${dirPath}`)\n const stats: StatsSummary[] = []\n const results = await fs.promises.readdir(dirPath)\n for (const test of results) {\n const filePath = path.join(dirPath, test, 'detailed-stats-summary.csv')\n if (!fs.existsSync(filePath)) continue\n const timestamp = fs.statSync(path.join(dirPath, test)).ctime.getTime()\n const data = await parseStatsFile(filePath)\n const { id, scenario } = nameParser(test)\n\n const aggregated = {\n timestamp,\n id,\n scenario,\n videoRecvBitratePerPixel: new FastStats(),\n videoRecvFps: new FastStats(),\n videoSentFps: new FastStats(),\n }\n data.forEach(v => {\n const { participantName, trackId } = v as { participantName: string; trackId: string }\n const metrics = v as Record<string, number>\n if (participantName === receiverParticipantName) {\n if (trackId?.endsWith('-v') && metrics.videoRecvFrames > 0) {\n const videoRecvBitratePerPixel =\n metrics.videoRecvBitrates / (metrics.videoRecvWidth * metrics.videoRecvHeight)\n if (!isNaN(videoRecvBitratePerPixel)) aggregated.videoRecvBitratePerPixel.push(videoRecvBitratePerPixel)\n if (!isNaN(metrics.videoRecvFps)) aggregated.videoRecvFps.push(metrics.videoRecvFps)\n }\n } else if (participantName === senderParticipantName) {\n if (trackId?.endsWith('-v') && metrics.videoSentFrames > 0) {\n if (!isNaN(metrics.videoSentFps)) aggregated.videoSentFps.push(metrics.videoSentFps)\n }\n }\n })\n stats.push(aggregated)\n }\n return stats.sort((a, b) => a.timestamp - b.timestamp)\n}\n\n/**\n * It uploads the aggregated stats to a Google Sheet.\n * A valid Google service account credentials file must be specified\n * in the `GOOGLE_CREDENTIALS_PATH` environment variable.\n * @param stats The aggregated stats to upload.\n * @param spreadsheetId The ID of the Google Spreadsheet.\n * @param table The name of the table (sheet) within the spreadsheet. Default is 'data'.\n */\nexport async function uploadStatsToGoogleSheet(stats: StatsSummary[], spreadsheetId: string, table = 'data') {\n log.debug(`uploadResultsToGoogleSheet spreadsheetId: ${spreadsheetId} table: ${table}`)\n if (!process.env.GOOGLE_CREDENTIALS_PATH) throw new Error('GOOGLE_CREDENTIALS_PATH environment variable is not set')\n if (!fs.existsSync(process.env.GOOGLE_CREDENTIALS_PATH))\n throw new Error(`Google credentials file not found: ${process.env.GOOGLE_CREDENTIALS_PATH}`)\n if (!stats.length) return\n const auth = new Auth.GoogleAuth({\n keyFile: process.env.GOOGLE_CREDENTIALS_PATH,\n scopes: ['https://www.googleapis.com/auth/spreadsheets'],\n })\n const sheets = google.sheets({ version: 'v4', auth })\n // Update headers.\n const headers = ['datetime', 'id', 'scenario', 'videoRecvBitratePerPixel', 'videoRecvFps']\n await sheets.spreadsheets.values.update({\n spreadsheetId,\n range: `${table}!A1:E1`,\n valueInputOption: 'USER_ENTERED',\n requestBody: { majorDimension: 'ROWS', values: [headers] },\n })\n // Append values.\n const values = [] as string[][]\n stats.forEach(s => {\n const { timestamp, id, scenario, videoRecvBitratePerPixel, videoRecvFps } = s\n if (!videoRecvBitratePerPixel.length) return\n const datetime = new Date(timestamp).toLocaleString('en-US', {\n timeZone: 'UTC',\n hourCycle: 'h23',\n })\n values.push([\n datetime,\n id,\n formatThrottleRule(parseThrottleRule(scenario), true),\n videoRecvBitratePerPixel.percentile(95).toFixed(3),\n videoRecvFps.percentile(95).toFixed(3),\n ])\n })\n if (values.length) {\n await sheets.spreadsheets.values.append({\n spreadsheetId,\n range: `${table}!A:E`,\n valueInputOption: 'USER_ENTERED',\n insertDataOption: 'INSERT_ROWS',\n requestBody: { majorDimension: 'ROWS', values },\n })\n }\n}\n\nexport type ThrottleDirection = 'up' | 'down' | 'bidi'\n\nexport function formatBitrate(bitrate: number | undefined, prefix = ' ', pad = true) {\n if (bitrate === undefined) return ''\n let suffix = 'Kbps'\n if (bitrate >= 1000) {\n bitrate /= 1000\n suffix = 'Mbps'\n }\n return `${prefix}${sprintf(`%${pad ? '5' : ''}.4g`, bitrate)}${suffix}`\n}\n\nexport function formatLoss(loss: number | undefined, prefix = ' ', pad = true) {\n return loss !== undefined ? `${prefix}${loss.toFixed(0).padStart(pad ? 2 : 0, ' ')}%` : ''\n}\n\nexport function formatDelay(delay: number | undefined, prefix = ' ', pad = true) {\n return delay !== undefined ? `${prefix}${delay.toFixed(0).padStart(pad ? 3 : 0, ' ')}ms` : ''\n}\n\nexport function formatThrottleRule(\n throttleRule: ThrottleRule & { direction: ThrottleDirection },\n human = false,\n pad = true,\n) {\n const { rate, loss, delay, direction } = throttleRule\n return human\n ? `${direction.padEnd(pad ? 4 : 0, ' ')}${formatBitrate(rate, ' ', pad)}${formatLoss(loss, ' ', pad)}${formatDelay(delay, ' ', pad)}`\n : `${direction}-r${rate}-l${loss}-d${delay}`\n}\n\nexport function parseThrottleRule(throttleDesc: string) {\n const match = throttleDesc.match(/(up|down|bidi)-r(\\d+)-l([\\d.]+)-d(\\d+)/)\n if (!match) throw new Error(`Invalid throttle description: ${throttleDesc}`)\n const direction = match[1] as ThrottleDirection\n const rate = parseInt(match[2])\n const loss = parseInt(match[3])\n const delay = parseInt(match[4])\n return { direction, rate, loss, delay }\n}\n\nexport async function plotStatsSummary(stats: StatsSummary[]) {\n const labels = new Set<string>()\n const data = {} as Record<string, Record<string, FastStats>>\n stats.forEach(s => {\n const { id, scenario, videoRecvBitratePerPixel } = s\n if (!videoRecvBitratePerPixel.length) return null\n if (!data[id]) {\n data[id] = {}\n }\n const scenarioFormatted = formatThrottleRule(parseThrottleRule(scenario), true, true)\n if (!data[id][scenarioFormatted]) {\n data[id][scenarioFormatted] = new FastStats()\n }\n labels.add(scenarioFormatted)\n data[id][scenarioFormatted].push(videoRecvBitratePerPixel.percentile(95))\n })\n const series: PlotData[] = []\n Object.entries(data)\n .sort((a, b) => a[0].localeCompare(b[0]))\n .forEach(([id, data]) => {\n const plotData: PlotData = { label: id, data: [] }\n Object.entries(data)\n .sort((a, b) => a[0].localeCompare(b[0]))\n .forEach(([scenario, stats]) => {\n plotData.data.push({\n x: scenario,\n y: stats.percentile(50),\n yMin: stats.percentile(5),\n yMax: stats.percentile(95),\n })\n })\n series.push(plotData)\n })\n await plotHtml(\n {\n type: 'barWithErrorBars',\n xLabel: 'Scenario',\n yLabel: 'Video Receive Bitrate per Pixel',\n labels: Array.from(labels).sort((a, b) => a.localeCompare(b)),\n },\n series,\n )\n}\n\n/**\n * It generates a test configuration with a scenario including 2 participants.\n * The first participant sends video and the second receives it.\n * Both participants send and receive audio.\n * The network conditions are applied according to the specified direction to the sender (`up`),\n * the receiver (`down`) or both (`bidi`).\n * The test is repeated the specified number of times.\n * The output is an array of partial configuration objects that can be used to run the tests\n * with the main application, after merging it with a configuration that includes\n * the destination url (mandatory) and other optional parameters.\n * @param id The unique identifier for the test scenario.\n * @param options.rate The target bandwidth in kbps.\n * @param options.loss The packet loss percentage.\n * @param options.delay The network delay in milliseconds.\n * @param options.direction The direction of the network throttling: 'up', 'down', or 'bidi'.\n * @param repeat The number of times to repeat the test scenario. Default is 1.\n * @returns An array of partial configuration objects for each test scenario.\n */\nexport async function twoParticipantsWithRateLossDelay(\n id: string,\n { rate, loss, delay, direction }: { rate: number; loss: number; delay: number; direction: ThrottleDirection },\n repeat = 1,\n) {\n const throttle: ThrottleConfig = {}\n const queue = 25\n if (direction === 'down' || direction === 'bidi') {\n throttle.down = [\n { rate: 20000, loss: 0, delay: 0, queue },\n { rate, loss, delay, queue, at: 30 },\n ]\n }\n if (direction === 'up' || direction === 'bidi') {\n throttle.up = [\n { rate: 20000, loss: 0, delay, queue },\n { rate, loss, delay, queue, at: 30 },\n ]\n }\n const throttleDesc = formatThrottleRule({ rate, loss, delay, direction })\n const now = Date.now()\n const ret: Partial<Config>[] = []\n for (let i = 0; i < repeat; i++) {\n const basePath = `logs/${now}-${i + 1}_${id}_${throttleDesc}`\n const sessions = direction === 'bidi' ? '0-1' : direction === 'down' ? '0' : '1'\n ret.push({\n sessions: 2,\n runDuration: 60 * 3,\n debuggingPort: 9000,\n prometheusPushgateway: 'http://localhost:9091',\n prometheusPushgatewayJobName: id,\n statsPath: `${basePath}/stats.csv`,\n detailedStatsPath: `${basePath}/detailed-stats.csv`,\n showPageLog: false,\n showStats: false,\n statsInterval: 5,\n scriptParams: JSON.stringify({\n enableMic: '0-1',\n enableCam: '1',\n }),\n throttleConfig: JSON.stringify([\n {\n sessions,\n protocol: 'udp',\n skipSourcePorts: '53,80,443',\n skipDestinationPorts: '53,80,443',\n ...throttle,\n },\n ]),\n })\n }\n return ret\n}\n"]}
@@ -254,7 +254,7 @@ class Server {
254
254
  throw new Error(`Session not found: "${sessionId}"`);
255
255
  }
256
256
  const filePath = await session.pageScreenshot(pageId, format);
257
- res.sendFile(path_1.default.resolve(filePath));
257
+ res.sendFile(path_1.default.resolve(filePath), { dotfiles: 'allow' });
258
258
  }
259
259
  catch (err) {
260
260
  next(err);
@@ -378,7 +378,7 @@ class Server {
378
378
  if (req.query.range && !req.headers.range) {
379
379
  req.headers.range = `bytes=${req.query.range}`;
380
380
  }
381
- res.sendFile(path_1.default.resolve(this.pageLogPath));
381
+ res.sendFile(path_1.default.resolve(this.pageLogPath), { dotfiles: 'allow' });
382
382
  }
383
383
  /**
384
384
  * GET /view/docker.log endpoint.
@@ -398,7 +398,7 @@ class Server {
398
398
  if (req.query.range && !req.headers.range) {
399
399
  req.headers.range = `bytes=${req.query.range}`;
400
400
  }
401
- res.sendFile(path_1.default.resolve(logPath));
401
+ res.sendFile(path_1.default.resolve(logPath), { dotfiles: 'allow' });
402
402
  }
403
403
  catch (err) {
404
404
  next(err);
@@ -451,7 +451,7 @@ class Server {
451
451
  if (req.query.range && !req.headers.range) {
452
452
  req.headers.range = `bytes=${req.query.range}`;
453
453
  }
454
- res.sendFile(fpath);
454
+ res.sendFile(fpath, { dotfiles: 'allow' });
455
455
  }
456
456
  getDataArchive(req, res, next) {
457
457
  log.debug(`GET /data`, req.query);
@@ -473,7 +473,7 @@ class Server {
473
473
  if (req.query.range && !req.headers.range) {
474
474
  req.headers.range = `bytes=${req.query.range}`;
475
475
  }
476
- res.sendFile(fpath);
476
+ res.sendFile(fpath, { dotfiles: 'allow' });
477
477
  }
478
478
  /**
479
479
  * Starts a new {@link Session} instance.