@vpalmisano/webrtcperf 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/LICENSE +661 -0
  2. package/README.md +296 -0
  3. package/app.min.js +2 -0
  4. package/build/src/app.d.ts +6 -0
  5. package/build/src/app.js +207 -0
  6. package/build/src/app.js.map +1 -0
  7. package/build/src/config.d.ts +104 -0
  8. package/build/src/config.js +880 -0
  9. package/build/src/config.js.map +1 -0
  10. package/build/src/generate-config-docs.d.ts +1 -0
  11. package/build/src/generate-config-docs.js +41 -0
  12. package/build/src/generate-config-docs.js.map +1 -0
  13. package/build/src/index.d.ts +9 -0
  14. package/build/src/index.js +26 -0
  15. package/build/src/index.js.map +1 -0
  16. package/build/src/media.d.ts +33 -0
  17. package/build/src/media.js +113 -0
  18. package/build/src/media.js.map +1 -0
  19. package/build/src/rtcstats.d.ts +302 -0
  20. package/build/src/rtcstats.js +418 -0
  21. package/build/src/rtcstats.js.map +1 -0
  22. package/build/src/server.d.ts +173 -0
  23. package/build/src/server.js +639 -0
  24. package/build/src/server.js.map +1 -0
  25. package/build/src/session.d.ts +277 -0
  26. package/build/src/session.js +1552 -0
  27. package/build/src/session.js.map +1 -0
  28. package/build/src/stats.d.ts +243 -0
  29. package/build/src/stats.js +1383 -0
  30. package/build/src/stats.js.map +1 -0
  31. package/build/src/utils.d.ts +249 -0
  32. package/build/src/utils.js +1220 -0
  33. package/build/src/utils.js.map +1 -0
  34. package/build/src/visqol.d.ts +6 -0
  35. package/build/src/visqol.js +61 -0
  36. package/build/src/visqol.js.map +1 -0
  37. package/build/src/vmaf.d.ts +83 -0
  38. package/build/src/vmaf.js +624 -0
  39. package/build/src/vmaf.js.map +1 -0
  40. package/build/tsconfig.tsbuildinfo +1 -0
  41. package/package.json +129 -0
  42. package/src/app.ts +241 -0
  43. package/src/config.ts +852 -0
  44. package/src/generate-config-docs.ts +47 -0
  45. package/src/index.ts +9 -0
  46. package/src/media.ts +151 -0
  47. package/src/rtcstats.ts +507 -0
  48. package/src/server.ts +645 -0
  49. package/src/session.ts +1908 -0
  50. package/src/stats.ts +1668 -0
  51. package/src/utils.ts +1295 -0
  52. package/src/visqol.ts +62 -0
  53. package/src/vmaf.ts +771 -0
@@ -0,0 +1,173 @@
1
+ import { Stats } from './stats';
2
+ /**
3
+ * An HTTP server instance that allows to control the tool using a REST
4
+ * interface. Moreover, it allows to aggregate stats data coming from multiple
5
+ * running tool instances.
6
+ */
7
+ export declare class Server {
8
+ /** The server listening port. */
9
+ readonly serverPort: number;
10
+ /** The basic auth secret. */
11
+ readonly serverSecret: string;
12
+ /** If HTTPS protocol should be used. */
13
+ readonly serverUseHttps: boolean;
14
+ /** An optional path that the HTTP server will expose with the /data endpoint. */
15
+ serverData: string;
16
+ /** The file path that will be used to serve the \`/view/page.log\` requests. */
17
+ pageLogPath: string;
18
+ /** The path that will be used to serve the \`/cache\` requests. */
19
+ videoCachePath: string;
20
+ /** A {@link Stats} class instance. */
21
+ stats: Stats;
22
+ private app;
23
+ private server;
24
+ private wss;
25
+ /**
26
+ * Server instance.
27
+ * All the HTTP endpoints are protected by basic authentication with user
28
+ * `admin` and password {@link Server.serverSecret}.
29
+ * @param serverPort The server listening port.
30
+ * @param serverSecret The basic auth secret.
31
+ * @param serverUseHttps If HTTPS protocol should be used.
32
+ * @param serverData An optional path that the HTTP server will expose with the /data endpoint.
33
+ * @param pageLogPath The file path that will be used to serve the \`/view/page.log\` requests.
34
+ * @param videoCachePath The path that will be used to serve the \`/cache\` requests.
35
+ * @param stats A {@link Stats} class instance.
36
+ */
37
+ constructor({ serverPort, serverSecret, serverUseHttps, serverData, pageLogPath, videoCachePath, }: {
38
+ serverPort?: number | undefined;
39
+ serverSecret?: string | undefined;
40
+ serverUseHttps?: boolean | undefined;
41
+ serverData?: string | undefined;
42
+ pageLogPath?: string | undefined;
43
+ videoCachePath?: string | undefined;
44
+ } | undefined, stats: Stats);
45
+ /**
46
+ * GET /stats endpoint.
47
+ *
48
+ * Returns a JSON array of the last statistics for each running Session.
49
+ */
50
+ private getStats;
51
+ /**
52
+ * GET /download/stats endpoint.
53
+ *
54
+ * Returns the {@link Stats.statsWriter} file content.
55
+ */
56
+ private getStatsFile;
57
+ /**
58
+ * GET /download/detailed-stats endpoint.
59
+ *
60
+ * Returns the {@link Stats.detailedStatsWriter} file content.
61
+ */
62
+ private getDetailedStatsFile;
63
+ /**
64
+ * GET /collected-stats endpoint.
65
+ *
66
+ * Returns a JSON array of the last statistics collected from external running
67
+ * tools.
68
+ */
69
+ private getCollectedStats;
70
+ /**
71
+ * GET /screenshot/<sessionID> endpoint.
72
+ *
73
+ * Returns the page screenshot running inside the {@link Session} identified
74
+ * by `sessionID`.
75
+ * Additional query params:
76
+ * - `page`: the page number (starting from `0`) running inside the {@link Session}.
77
+ * - `format`: the image format (`jpeg`, `png`, `webp`). Default: `webp`.
78
+ */
79
+ private getScreenshot;
80
+ /**
81
+ * PUT /collected-stats endpoint.
82
+ *
83
+ * Allows to inject {@link Stats} metrics coming from an external tool.
84
+ */
85
+ private putCollectedStats;
86
+ /**
87
+ * PUT /session endpoint.
88
+ *
89
+ * Starts a new {@link Session}.
90
+ * The request body format will be parsed as a {@link SessionParams} object.
91
+ */
92
+ private putSession;
93
+ /**
94
+ * PUT /sessions endpoint.
95
+ *
96
+ * Starts multiple {@link Session} instances as specified into the
97
+ * `body.sessions` value.
98
+ * The request body will be parsed as a {@link SessionParams} object.
99
+ */
100
+ private putSessions;
101
+ /**
102
+ * DELETE /session endpoint.
103
+ *
104
+ * Delete the {@link Session} instance identified by the `body.id` param.
105
+ */
106
+ private deleteSession;
107
+ /**
108
+ * DELETE /sessions endpoint.
109
+ *
110
+ * Delete the {@link Session} instances specified by the `body.ids` array.
111
+ */
112
+ private deleteSessions;
113
+ /**
114
+ * GET /view/page.log endpoint.
115
+ *
116
+ * Returns the page log file content as specified in {@link Config} `pageLogPath`.
117
+ */
118
+ private getPageLog;
119
+ /**
120
+ * GET /view/docker.log endpoint.
121
+ *
122
+ * Returns the Docker logs related to the container running the tool.
123
+ * It requires to run the Docker container with the following options:
124
+ * ```
125
+ --cidfile /tmp/docker.id
126
+ -v /tmp/docker.id:/root/.webrtcperf/docker.id:ro
127
+ -v /var/lib/docker:/var/lib/docker:ro
128
+ * ```
129
+ */
130
+ private getDockerLog;
131
+ /**
132
+ * GET /download/alert-rules endpoint.
133
+ *
134
+ * Downloads the alert rules report stored into the {@link Stats.alertRulesFilename}.
135
+ */
136
+ private getAlertRules;
137
+ /**
138
+ * GET /empty-page endpoint.
139
+ *
140
+ * Returns an empty HTML page. Useful for running tests with raw Javascript
141
+ * content without any DOM rendering.
142
+ */
143
+ private getEmptyPage;
144
+ /**
145
+ * GET /data/* endpoint.
146
+ *
147
+ * Returns the file content relative to the {@link Config} `serverData` path.
148
+ * If the requested path points to a directory, it returns the directory
149
+ * content in tar.gz format.
150
+ */
151
+ private getData;
152
+ private getDataArchive;
153
+ private getCache;
154
+ /**
155
+ * Starts a new {@link Session} instance.
156
+ * @param id The session unique id.
157
+ * @param config The session configuration.
158
+ */
159
+ private startLocalSession;
160
+ /**
161
+ * Stops a new {@link Session} instance.
162
+ * @param {number} id The session unique id.
163
+ */
164
+ private stopLocalSession;
165
+ /**
166
+ * Starts the {@link Server} instance.
167
+ */
168
+ start(): Promise<void>;
169
+ /**
170
+ * Stops the {@link Server} instance.
171
+ */
172
+ stop(): void;
173
+ }