@norskvideo/ctl-test-harness 0.1.95 → 0.1.97
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/daemon.d.ts +2 -2
- package/daemon.js +6 -6
- package/media-conversion/run.d.ts +13 -1
- package/media-conversion/run.js +36 -21
- package/package.json +1 -1
package/daemon.d.ts
CHANGED
|
@@ -102,8 +102,8 @@ export declare function seedDaemonConfig(storeDir: string): void;
|
|
|
102
102
|
* (and each daemon start `rm -f`s the cpu-monitor sidecar by name). The port
|
|
103
103
|
* alone is not unique there -- two repos' slugs can hash into the same band --
|
|
104
104
|
* so the names carry the store dir too, which is per run and per job. A ctl
|
|
105
|
-
* that predates an override ignores it.
|
|
106
|
-
*
|
|
105
|
+
* that predates an override ignores it. A test daemon runs without the node
|
|
106
|
+
* MoQ relay: one of its own would need its own name and three host ports. */
|
|
107
107
|
export declare function daemonSpawnEnv(o: {
|
|
108
108
|
storeDir: string;
|
|
109
109
|
port: number;
|
package/daemon.js
CHANGED
|
@@ -231,8 +231,8 @@ export function seedDaemonConfig(storeDir) {
|
|
|
231
231
|
* (and each daemon start `rm -f`s the cpu-monitor sidecar by name). The port
|
|
232
232
|
* alone is not unique there -- two repos' slugs can hash into the same band --
|
|
233
233
|
* so the names carry the store dir too, which is per run and per job. A ctl
|
|
234
|
-
* that predates an override ignores it.
|
|
235
|
-
*
|
|
234
|
+
* that predates an override ignores it. A test daemon runs without the node
|
|
235
|
+
* MoQ relay: one of its own would need its own name and three host ports. */
|
|
236
236
|
export function daemonSpawnEnv(o) {
|
|
237
237
|
// A spawned daemon must boot GUARDED: exercising the real ingress secret is
|
|
238
238
|
// the point of the tiers that spawn one. The unit tier's marker would
|
|
@@ -243,10 +243,10 @@ export function daemonSpawnEnv(o) {
|
|
|
243
243
|
return {
|
|
244
244
|
NORSK_CTL_PROXY_CONTAINER: `norsk-proxy-${id}`,
|
|
245
245
|
NORSK_CTL_CPU_MONITOR_CONTAINER: `norsk-ctl-cpu-monitor-${id}`,
|
|
246
|
-
// No node MoQ relay: it
|
|
247
|
-
//
|
|
248
|
-
//
|
|
249
|
-
//
|
|
246
|
+
// No node MoQ relay: the daemon never removes it, so a test daemon would
|
|
247
|
+
// leave one behind (probe's smoke ran in relay mode on 2026-10-10).
|
|
248
|
+
// Instances keep their own MoQ listener. A caller that wants the relay
|
|
249
|
+
// sets it explicitly, with NORSK_CTL_MOQ_RELAY_CONTAINER and its ports.
|
|
250
250
|
NORSK_CTL_MOQ_RELAY_ENABLE: "0",
|
|
251
251
|
...inherited,
|
|
252
252
|
NORSK_CTL_STORE_DIR: o.storeDir,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { MediaConversionV1 } from "@norskvideo/ctl-product-template-schema";
|
|
2
|
-
import { type Norsk, type NorskLinkTransport } from "@norskvideo/norsk-sdk";
|
|
2
|
+
import { type Norsk, type NorskLinkTransport, type StreamKey } from "@norskvideo/norsk-sdk";
|
|
3
3
|
import { type Check, type Observation } from "./evaluate.js";
|
|
4
4
|
export type ConversionLauncher = {
|
|
5
5
|
/** Start the template with these launch values. Resolves once it is launched;
|
|
@@ -43,4 +43,16 @@ export type ConformanceResult = {
|
|
|
43
43
|
values: Record<string, string>;
|
|
44
44
|
observation: Observation;
|
|
45
45
|
};
|
|
46
|
+
/** The source programme's tracks: one source name, a stream id each (video
|
|
47
|
+
* first, from 256, as a TS programme numbers them). A conversion's norsk-link
|
|
48
|
+
* input keys what it receives under its own source name, so tracks told apart
|
|
49
|
+
* by source name alone would collide there. */
|
|
50
|
+
export declare function programmeKeys(prefix: string, counts: {
|
|
51
|
+
video: number;
|
|
52
|
+
audio: number;
|
|
53
|
+
}): {
|
|
54
|
+
kind: "video" | "audio";
|
|
55
|
+
index: number;
|
|
56
|
+
key: StreamKey;
|
|
57
|
+
}[];
|
|
46
58
|
export declare function runMediaConversionConformance(opts: ConformanceOptions): Promise<ConformanceResult>;
|
package/media-conversion/run.js
CHANGED
|
@@ -10,6 +10,21 @@ function stamp(t) {
|
|
|
10
10
|
}
|
|
11
11
|
const keyOf = (k) => `${k.sourceName}/${k.programNumber}/${k.streamId}/${k.renditionName}`;
|
|
12
12
|
const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
|
|
13
|
+
/** The source programme's tracks: one source name, a stream id each (video
|
|
14
|
+
* first, from 256, as a TS programme numbers them). A conversion's norsk-link
|
|
15
|
+
* input keys what it receives under its own source name, so tracks told apart
|
|
16
|
+
* by source name alone would collide there. */
|
|
17
|
+
export function programmeKeys(prefix, counts) {
|
|
18
|
+
const tracks = [
|
|
19
|
+
...Array.from({ length: counts.video }, (_, index) => ({ kind: "video", index })),
|
|
20
|
+
...Array.from({ length: counts.audio }, (_, index) => ({ kind: "audio", index })),
|
|
21
|
+
];
|
|
22
|
+
return tracks.map((t, i) => ({
|
|
23
|
+
...t,
|
|
24
|
+
key: { sourceName: `${prefix}-source`, programNumber: 1, streamId: 256 + i, renditionName: "default" },
|
|
25
|
+
}));
|
|
26
|
+
}
|
|
27
|
+
/** The source programme's tracks, and every node behind them (to close). */
|
|
13
28
|
async function startSources(norsk, prefix, declaration) {
|
|
14
29
|
if (declaration.inputs.length !== 1) {
|
|
15
30
|
throw new Error(`conformance: v1 drives exactly one input, the declaration has ${declaration.inputs.length}`);
|
|
@@ -19,29 +34,29 @@ async function startSources(norsk, prefix, declaration) {
|
|
|
19
34
|
const count = kinds[kind];
|
|
20
35
|
return typeof count === "number" ? count : (count?.min ?? 0);
|
|
21
36
|
};
|
|
22
|
-
const sources = [];
|
|
23
|
-
for (let i = 0; i < want("video"); i++) {
|
|
24
|
-
sources.push(await norsk.input.videoTestCard({
|
|
25
|
-
id: `${prefix}-video-${i}`,
|
|
26
|
-
sourceName: `${prefix}-video-${i}`,
|
|
27
|
-
resolution: { width: 1920, height: 1080 },
|
|
28
|
-
frameRate: { frames: 25, seconds: 1 },
|
|
29
|
-
pattern: "smpte75",
|
|
30
|
-
}));
|
|
31
|
-
}
|
|
32
|
-
for (let i = 0; i < want("audio"); i++) {
|
|
33
|
-
sources.push(await norsk.input.audioSignal({
|
|
34
|
-
id: `${prefix}-audio-${i}`,
|
|
35
|
-
sourceName: `${prefix}-audio-${i}`,
|
|
36
|
-
channelLayout: "stereo",
|
|
37
|
-
sampleRate: 48000,
|
|
38
|
-
}));
|
|
39
|
-
}
|
|
40
37
|
for (const kind of ["subtitle", "ancillary"]) {
|
|
41
38
|
if (want(kind) > 0)
|
|
42
39
|
throw new Error(`conformance: no ${kind} test source yet`);
|
|
43
40
|
}
|
|
44
|
-
|
|
41
|
+
const tracks = [];
|
|
42
|
+
const nodes = [];
|
|
43
|
+
for (const track of programmeKeys(prefix, { video: want("video"), audio: want("audio") })) {
|
|
44
|
+
const id = `${prefix}-${track.kind}-${track.index}`;
|
|
45
|
+
const signal = track.kind === "video"
|
|
46
|
+
? await norsk.input.videoTestCard({
|
|
47
|
+
id,
|
|
48
|
+
sourceName: id,
|
|
49
|
+
resolution: { width: 1920, height: 1080 },
|
|
50
|
+
frameRate: { frames: 25, seconds: 1 },
|
|
51
|
+
pattern: "smpte75",
|
|
52
|
+
})
|
|
53
|
+
: await norsk.input.audioSignal({ id, sourceName: id, channelLayout: "stereo", sampleRate: 48000 });
|
|
54
|
+
const keyed = await norsk.processor.transform.streamKeyOverride({ id: `${id}-key`, streamKey: track.key });
|
|
55
|
+
keyed.subscribe([{ source: signal, sourceSelector: track.kind === "video" ? selectVideo : selectAudio }]);
|
|
56
|
+
tracks.push(keyed);
|
|
57
|
+
nodes.push(keyed, signal);
|
|
58
|
+
}
|
|
59
|
+
return { tracks, nodes };
|
|
45
60
|
}
|
|
46
61
|
export async function runMediaConversionConformance(opts) {
|
|
47
62
|
const { norsk, declaration, launcher, links } = opts;
|
|
@@ -50,7 +65,7 @@ export async function runMediaConversionConformance(opts) {
|
|
|
50
65
|
const observeMs = opts.observeMs ?? 10_000;
|
|
51
66
|
const selectAll = (streams) => [...selectVideo(streams), ...selectAudio(streams)];
|
|
52
67
|
const sent = new Set();
|
|
53
|
-
const sources = await startSources(norsk, prefix, declaration);
|
|
68
|
+
const { tracks: sources, nodes: sourceNodes } = await startSources(norsk, prefix, declaration);
|
|
54
69
|
const near = await norsk.inspect.streamTimestampReport({
|
|
55
70
|
id: `${prefix}-sent`,
|
|
56
71
|
onTimestamp: (_k, t) => {
|
|
@@ -137,7 +152,7 @@ export async function runMediaConversionConformance(opts) {
|
|
|
137
152
|
}
|
|
138
153
|
finally {
|
|
139
154
|
await launcher.stop().catch(() => { });
|
|
140
|
-
for (const node of [far, returned, sourceLink, near, ...
|
|
155
|
+
for (const node of [far, returned, sourceLink, near, ...sourceNodes])
|
|
141
156
|
await node.close().catch(() => { });
|
|
142
157
|
}
|
|
143
158
|
const observation = { sent, phases };
|