@blockcast/mmt-container 0.4.0-main.bbd83cb48eff → 0.4.0-main.bbdfdbf39ded
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/README.md +31 -17
- package/dist/align.d.ts +24 -18
- package/dist/align.d.ts.map +1 -1
- package/dist/align.js +23 -4
- package/dist/align.js.map +2 -2
- package/dist/browser-runtime.js +1192 -375
- package/dist/browser-runtime.js.map +4 -4
- package/dist/carp-catalog.d.ts +67 -31
- package/dist/carp-catalog.d.ts.map +1 -1
- package/dist/carp-catalog.js +291 -199
- package/dist/carp-catalog.js.map +3 -3
- package/dist/catalog-fec-params.d.ts +12 -4
- package/dist/catalog-fec-params.d.ts.map +1 -1
- package/dist/catalog-fec-params.js +40 -17
- package/dist/catalog-fec-params.js.map +3 -3
- package/dist/catalog-network-source.d.ts +24 -2
- package/dist/catalog-network-source.d.ts.map +1 -1
- package/dist/catalog-network-source.js +21 -1
- package/dist/catalog-network-source.js.map +2 -2
- package/dist/catalog-validator.d.ts +4 -3
- package/dist/catalog-validator.d.ts.map +1 -1
- package/dist/catalog-validator.js +0 -29
- package/dist/catalog-validator.js.map +3 -3
- package/dist/delivery-catalog.js +18 -12
- package/dist/delivery-catalog.js.map +4 -4
- package/dist/fec-manager.d.ts +49 -1
- package/dist/fec-manager.d.ts.map +1 -1
- package/dist/fec-manager.js +176 -23
- package/dist/fec-manager.js.map +3 -3
- package/dist/fec-state.d.ts +2 -1
- package/dist/fec-state.d.ts.map +1 -1
- package/dist/fec-state.js +18 -3
- package/dist/fec-state.js.map +3 -3
- package/dist/fec-worker-setup.d.ts +2 -0
- package/dist/fec-worker-setup.d.ts.map +1 -1
- package/dist/fec-worker-setup.js +2 -1
- package/dist/fec-worker-setup.js.map +2 -2
- package/dist/index.d.ts +5 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -8
- package/dist/index.js.map +2 -2
- package/dist/iso-block-locator.d.ts +29 -0
- package/dist/iso-block-locator.d.ts.map +1 -1
- package/dist/iso-block-locator.js +97 -17
- package/dist/iso-block-locator.js.map +3 -3
- package/dist/manifest-auth-plan.d.ts +26 -25
- package/dist/manifest-auth-plan.d.ts.map +1 -1
- package/dist/manifest-auth-plan.js +331 -1171
- package/dist/manifest-auth-plan.js.map +4 -4
- package/dist/mfu-reassembler.js.map +2 -2
- package/dist/mmtp-container-parser.js.map +2 -2
- package/dist/mmtp-container-parser.no-modules.js +1014 -289
- package/dist/mmtp-container-parser.no-modules.js.map +4 -4
- package/dist/mmtp-decode-pipeline.js.map +2 -2
- package/dist/mmtp-fec-session.d.ts +159 -0
- package/dist/mmtp-fec-session.d.ts.map +1 -0
- package/dist/mmtp-fec-session.js +531 -0
- package/dist/mmtp-fec-session.js.map +7 -0
- package/dist/mmtp-router.d.ts +17 -1
- package/dist/mmtp-router.d.ts.map +1 -1
- package/dist/mmtp-router.js +29 -0
- package/dist/mmtp-router.js.map +2 -2
- package/dist/multicast-auth-catalog.d.ts +86 -92
- package/dist/multicast-auth-catalog.d.ts.map +1 -1
- package/dist/multicast-auth-catalog.js +347 -132
- package/dist/multicast-auth-catalog.js.map +4 -4
- package/dist/multicast-input.d.ts +28 -6
- package/dist/multicast-input.d.ts.map +1 -1
- package/dist/multicast-input.js +290 -28
- package/dist/multicast-input.js.map +3 -3
- package/dist/multicast-manager.d.ts +40 -5
- package/dist/multicast-manager.d.ts.map +1 -1
- package/dist/multicast-manager.js +293 -54
- package/dist/multicast-manager.js.map +4 -4
- package/dist/multicast-transport.d.ts +6 -0
- package/dist/multicast-transport.d.ts.map +1 -1
- package/dist/multicast-transport.js +18 -11
- package/dist/multicast-transport.js.map +4 -4
- package/dist/multicast-unwrap.js.map +2 -2
- package/dist/no-modules.d.ts +4 -1
- package/dist/no-modules.d.ts.map +1 -1
- package/dist/no-modules.js +964 -274
- package/dist/no-modules.js.map +4 -4
- package/dist/phase14-catalog-override.d.ts +1 -1
- package/dist/phase14-catalog-override.d.ts.map +1 -1
- package/dist/phase14-catalog-override.js +2 -2
- package/dist/phase14-catalog-override.js.map +2 -2
- package/dist/repair-fetch.d.ts +81 -6
- package/dist/repair-fetch.d.ts.map +1 -1
- package/dist/repair-fetch.js +156 -31
- package/dist/repair-fetch.js.map +3 -3
- package/dist/repair-layers.d.ts +2 -0
- package/dist/repair-layers.d.ts.map +1 -1
- package/dist/repair-layers.js +19 -2
- package/dist/repair-layers.js.map +2 -2
- package/dist/signaling.d.ts +2 -2
- package/dist/signaling.d.ts.map +1 -1
- package/dist/signaling.js +3 -3
- package/dist/signaling.js.map +2 -2
- package/dist/source-auth.js +2710 -7
- package/dist/source-auth.js.map +4 -4
- package/dist/switching-set-alignment.d.ts +1 -1
- package/dist/switching-set-alignment.js.map +1 -1
- package/dist/timestamp-codec.js.map +2 -2
- package/dist/wasm-mfu-reassembler.js.map +1 -1
- package/dist/wasm-mmtp-container-parser.js.map +2 -2
- package/package.json +6 -9
- package/schemas/catalog.schema.json +124 -37
- package/src/align.ts +52 -21
- package/src/carp-catalog.ts +131 -52
- package/src/catalog-fec-params.ts +28 -3
- package/src/catalog-network-source.ts +45 -2
- package/src/catalog-validator.ts +4 -11
- package/src/fec-manager.ts +128 -14
- package/src/fec-state.ts +11 -4
- package/src/fec-worker-setup.ts +4 -1
- package/src/index.ts +24 -10
- package/src/iso-block-locator.ts +97 -6
- package/src/manifest-auth-plan.ts +39 -91
- package/src/mmtp-fec-session.ts +533 -0
- package/src/mmtp-router.ts +57 -0
- package/src/multicast-auth-catalog.ts +131 -238
- package/src/multicast-input.ts +119 -61
- package/src/multicast-manager.ts +115 -14
- package/src/multicast-transport.ts +3 -0
- package/src/no-modules.ts +7 -1
- package/src/phase14-catalog-override.ts +3 -3
- package/src/repair-fetch.ts +283 -39
- package/src/repair-layers.ts +22 -2
- package/src/signaling.ts +2 -2
- package/src/switching-set-alignment.ts +1 -1
- package/test-vectors/align.json +108 -32
- package/test-vectors/bc-provenance-v2.json +1526 -0
- package/test-vectors/catalog/README.md +60 -3
- package/test-vectors/catalog/negative/fec-block-profile-missing.json +1 -1
- package/test-vectors/catalog/negative/fec-block-profile-retired.json +1 -1
- package/test-vectors/catalog/negative/fec-block-profile-unknown.json +1 -1
- package/test-vectors/catalog/negative/fec-iso-symbol-size-below-floor.json +28 -0
- package/test-vectors/catalog/negative/fec-reed-solomon-iso-symbol-size-13.json +28 -0
- package/test-vectors/catalog/negative/fec-reed-solomon-k-plus-p-over-255.json +39 -0
- package/test-vectors/catalog/negative/fec-reed-solomon-overlay-over-255.json +40 -0
- package/test-vectors/catalog/negative/fec-repair-overlay-source-symbols-zero.json +43 -0
- package/test-vectors/catalog/negative/fec-repair-symbols-zero.json +28 -0
- package/test-vectors/catalog/negative/fec-source-symbols-zero.json +28 -0
- package/test-vectors/catalog/negative/fec-symbol-size-zero.json +28 -0
- package/test-vectors/catalog/negative/init-data-inline-without-data.json +22 -0
- package/test-vectors/catalog/negative/mmtp-mode-mpu.json +15 -0
- package/test-vectors/catalog/negative/multicast-amt-dns-without-relay.json +37 -0
- package/test-vectors/catalog/negative/multicast-auth-asm-missing-sender-address.json +77 -0
- package/test-vectors/catalog/negative/multicast-auth-duplicate-first-epoch.json +56 -0
- package/test-vectors/catalog/negative/multicast-auth-duplicate-kid.json +56 -0
- package/test-vectors/catalog/negative/multicast-auth-endpoint-auth-without-object-auth.json +38 -0
- package/test-vectors/catalog/negative/multicast-auth-endpoint-missing-auth.json +49 -0
- package/test-vectors/catalog/negative/multicast-auth-endpoint-missing-bandwidth.json +55 -0
- package/test-vectors/catalog/negative/multicast-auth-manifest-port-equals-port.json +56 -0
- package/test-vectors/catalog/negative/multicast-auth-manifest-timer-out-of-range.json +56 -0
- package/test-vectors/catalog/negative/multicast-auth-max-auth-delay-above-max.json +56 -0
- package/test-vectors/catalog/negative/multicast-auth-max-auth-delay-below-min.json +56 -0
- package/test-vectors/catalog/negative/multicast-auth-root-dotted-key.json +55 -0
- package/test-vectors/catalog/negative/multicast-auth-sender-address-on-ssm.json +57 -0
- package/test-vectors/catalog/negative/multicast-auth-version-1.json +56 -0
- package/test-vectors/catalog/negative/multicast-auth-version-3.json +56 -0
- package/test-vectors/catalog/negative/multicast-auth-version-missing.json +55 -0
- package/test-vectors/catalog/negative/multicast-endpoint-foreign-namespace-track.json +44 -0
- package/test-vectors/catalog/negative/multicast-endpoint-protocol-amt.json +38 -0
- package/test-vectors/catalog/negative/multicast-endpoint-protocol-atsc3.json +38 -0
- package/test-vectors/catalog/negative/presentation-anchor-unsafe.json +16 -0
- package/test-vectors/catalog/positive/fec-algorithm-unimplemented.json +29 -0
- package/test-vectors/catalog/positive/fec-iso-ssbg1.json +1 -1
- package/test-vectors/catalog/positive/fec-multicast.json +1 -1
- package/test-vectors/catalog/positive/fec-reed-solomon-layered.json +50 -0
- package/test-vectors/catalog/positive/mmt01-12-1-init-ref-anchor.json +29 -0
- package/test-vectors/catalog/positive/multicast-amt-discovery-omitted.json +37 -0
- package/test-vectors/catalog/positive/multicast-amt-dns-relay.json +38 -0
- package/test-vectors/catalog/positive/multicast-amt-manual-relay.json +2 -2
- package/test-vectors/catalog/{negative/multicast-endpoint-missing-protocol-and-source.json → positive/multicast-asm-unprotected.json} +10 -5
- package/test-vectors/catalog/positive/multicast-auth-asm-sender.json +78 -0
- package/test-vectors/catalog/positive/multicast-auth-rotation.json +39 -38
- package/test-vectors/catalog/positive/multicast-draft01-4-1-example.json +81 -0
- package/test-vectors/catalog/positive/multicast-draft01-7-2-6-example.json +70 -0
- package/test-vectors/catalog/positive/presentation-anchor-negative.json +27 -0
- package/test-vectors/catalog/section-codes.json +30 -1
- package/test-vectors/catalog-multicast-auth-v1.json +38 -20
- package/test-vectors/catalog-validation.json +6 -5
- package/test-vectors/catalog-validator-public-api.mjs +14 -9
- package/test-vectors/generate-bc-provenance-v2.mjs +252 -0
- package/dist/fec-codec.d.ts +0 -32
- package/dist/fec-codec.d.ts.map +0 -1
- package/dist/fec-codec.js +0 -47
- package/dist/fec-codec.js.map +0 -7
- package/src/fec-codec.ts +0 -61
package/dist/carp-catalog.js
CHANGED
|
@@ -28,196 +28,254 @@ function parseFecBlockProfile(value, where) {
|
|
|
28
28
|
|
|
29
29
|
// ../mmt-base/dist/catalog-fec-source.js
|
|
30
30
|
var ALL_ROLES = Object.freeze(["video", "audio"]);
|
|
31
|
+
var ISO_SSBG1_MIN_SYMBOL_SIZE = 14;
|
|
31
32
|
|
|
32
|
-
//
|
|
33
|
-
var
|
|
34
|
-
var
|
|
35
|
-
var
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
output += BASE64URL_ALPHABET[b2 & 63];
|
|
48
|
-
}
|
|
49
|
-
return output;
|
|
50
|
-
}
|
|
51
|
-
var BASE64URL_DECODE_TABLE = (() => {
|
|
52
|
-
const table = new Int8Array(128).fill(-1);
|
|
53
|
-
for (let i = 0; i < BASE64URL_ALPHABET.length; i++) {
|
|
54
|
-
table[BASE64URL_ALPHABET.charCodeAt(i)] = i;
|
|
55
|
-
}
|
|
56
|
-
return table;
|
|
57
|
-
})();
|
|
58
|
-
function decodeBase64Url(text) {
|
|
59
|
-
if (text.length % 4 === 1) {
|
|
60
|
-
throw new Error(`[multicast-auth-catalog] invalid unpadded base64url length for "${text}"`);
|
|
61
|
-
}
|
|
62
|
-
const bytes = [];
|
|
63
|
-
let buffer = 0;
|
|
64
|
-
let bits = 0;
|
|
65
|
-
for (let i = 0; i < text.length; i++) {
|
|
66
|
-
const code = text.charCodeAt(i);
|
|
67
|
-
const value = code < 128 ? BASE64URL_DECODE_TABLE[code] : -1;
|
|
68
|
-
if (value === void 0 || value < 0) {
|
|
69
|
-
throw new Error(`[multicast-auth-catalog] invalid base64url character in "${text}"`);
|
|
70
|
-
}
|
|
71
|
-
buffer = buffer << 6 | value;
|
|
72
|
-
bits += 6;
|
|
73
|
-
if (bits >= 8) {
|
|
74
|
-
bits -= 8;
|
|
75
|
-
bytes.push(buffer >> bits & 255);
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
const decoded = Uint8Array.from(bytes);
|
|
79
|
-
if (encodeBase64Url(decoded) !== text) {
|
|
80
|
-
throw new Error(`[multicast-auth-catalog] non-canonical base64url encoding "${text}"`);
|
|
81
|
-
}
|
|
82
|
-
return decoded;
|
|
83
|
-
}
|
|
84
|
-
function decodeAuthScope(authScope) {
|
|
85
|
-
const bytes = decodeBase64Url(authScope);
|
|
86
|
-
if (bytes.byteLength !== SOURCE_AUTH_SCOPE_LENGTH) {
|
|
87
|
-
throw new Error(
|
|
88
|
-
`[multicast-auth-catalog] authScope must decode to ${SOURCE_AUTH_SCOPE_LENGTH} raw bytes, got ${bytes.byteLength}`
|
|
89
|
-
);
|
|
90
|
-
}
|
|
91
|
-
return bytes;
|
|
92
|
-
}
|
|
93
|
-
function decodeEd25519PublicKey(publicKey) {
|
|
94
|
-
const bytes = decodeBase64Url(publicKey);
|
|
95
|
-
if (bytes.byteLength !== RAW_ED25519_KEY_LENGTH) {
|
|
96
|
-
throw new Error(
|
|
97
|
-
`[multicast-auth-catalog] public key must decode to ${RAW_ED25519_KEY_LENGTH} raw bytes, got ${bytes.byteLength}`
|
|
98
|
-
);
|
|
99
|
-
}
|
|
100
|
-
return bytes;
|
|
33
|
+
// ../mmt-base/dist/multicast-catalog.js
|
|
34
|
+
var ED25519_PUBLIC_KEY_BASE64URL = /^[A-Za-z0-9_-]{42}[AEIMQUYcgkosw048]$/;
|
|
35
|
+
var UINT32_MAX = 4294967295;
|
|
36
|
+
var AUTH_MEMBERS = /* @__PURE__ */ new Set(["scheme", "version", "sig", "keys", "minEpoch"]);
|
|
37
|
+
var KEY_MEMBERS = /* @__PURE__ */ new Set(["kid", "publicKey", "firstEpoch"]);
|
|
38
|
+
var ENDPOINT_AUTH_MEMBERS = /* @__PURE__ */ new Set([
|
|
39
|
+
"manifestPort",
|
|
40
|
+
"streamId",
|
|
41
|
+
"senderAddress",
|
|
42
|
+
"maxAuthDelayMs",
|
|
43
|
+
"manifestTimerMs",
|
|
44
|
+
"manifestTrack"
|
|
45
|
+
]);
|
|
46
|
+
function isObject(value) {
|
|
47
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
101
48
|
}
|
|
102
49
|
function isNonEmptyString(value) {
|
|
103
|
-
return typeof value === "string" && value.length > 0;
|
|
50
|
+
return typeof value === "string" && value.trim().length > 0;
|
|
104
51
|
}
|
|
105
|
-
function
|
|
106
|
-
|
|
107
|
-
try {
|
|
108
|
-
decodeAuthScope(value);
|
|
109
|
-
return true;
|
|
110
|
-
} catch {
|
|
111
|
-
return false;
|
|
112
|
-
}
|
|
52
|
+
function isIntegerIn(value, min, max) {
|
|
53
|
+
return Number.isSafeInteger(value) && value >= min && value <= max;
|
|
113
54
|
}
|
|
114
|
-
function
|
|
115
|
-
if (!
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
const
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
if (
|
|
129
|
-
|
|
130
|
-
return
|
|
131
|
-
}
|
|
132
|
-
var VALID_COMPACTION = /* @__PURE__ */ new Set(["merkle", "none"]);
|
|
133
|
-
var VALID_ENFORCEMENT = /* @__PURE__ */ new Set(["shadow", "enforce"]);
|
|
134
|
-
function hasUniqueMulticastAuthTrackBindings(tracks) {
|
|
135
|
-
const bindings = tracks.flatMap((track) => {
|
|
136
|
-
if (typeof track !== "object" || track === null) return [];
|
|
137
|
-
const value = track;
|
|
138
|
-
if (typeof value["mediaTrack"] !== "string" || typeof value["sourceSymbolFormat"] !== "string") {
|
|
139
|
-
return [];
|
|
140
|
-
}
|
|
141
|
-
return [JSON.stringify([value["mediaTrack"], value["sourceSymbolFormat"]])];
|
|
142
|
-
});
|
|
143
|
-
return new Set(bindings).size === bindings.length;
|
|
144
|
-
}
|
|
145
|
-
function isMulticastAuthConfig(obj) {
|
|
146
|
-
if (typeof obj !== "object" || obj === null) return false;
|
|
147
|
-
const o = obj;
|
|
148
|
-
if (o["scheme"] !== "bc-provenance") return false;
|
|
149
|
-
if (o["hash"] !== "blake3") return false;
|
|
150
|
-
if (o["sig"] !== "ed25519") return false;
|
|
151
|
-
if (!hasOnlyKeys(o, ["scheme", "hash", "sig", "publicKey", "keyId", "previousKey", "compaction", "enforcement", "tracks"])) return false;
|
|
152
|
-
if (!isValidPublicKeyField(o["publicKey"])) return false;
|
|
153
|
-
if (!isNonEmptyString(o["keyId"])) return false;
|
|
154
|
-
if (o["previousKey"] !== void 0 && !isValidPublicKeyField(o["previousKey"])) return false;
|
|
155
|
-
if (o["previousKey"] === o["publicKey"]) return false;
|
|
156
|
-
if (typeof o["compaction"] !== "string" || !VALID_COMPACTION.has(o["compaction"])) return false;
|
|
157
|
-
if (o["enforcement"] !== void 0) {
|
|
158
|
-
if (typeof o["enforcement"] !== "string" || !VALID_ENFORCEMENT.has(o["enforcement"])) return false;
|
|
159
|
-
}
|
|
160
|
-
if (!Array.isArray(o["tracks"]) || o["tracks"].length === 0) return false;
|
|
161
|
-
const tracks = o["tracks"];
|
|
162
|
-
if (!tracks.every((t) => isMulticastAuthTrackConfig(t))) return false;
|
|
163
|
-
const typedTracks = tracks;
|
|
164
|
-
const scopes = typedTracks.map((t) => t.authScope);
|
|
165
|
-
if (new Set(scopes).size !== scopes.length) return false;
|
|
166
|
-
if (!hasUniqueMulticastAuthTrackBindings(typedTracks)) return false;
|
|
167
|
-
const manifestTracks = typedTracks.map((t) => t.manifestTrack);
|
|
168
|
-
if (new Set(manifestTracks).size !== manifestTracks.length) return false;
|
|
169
|
-
return true;
|
|
55
|
+
function multicastEndpointSource(endpoint) {
|
|
56
|
+
if (!isObject(endpoint))
|
|
57
|
+
return void 0;
|
|
58
|
+
const sourceAddress = endpoint["sourceAddress"];
|
|
59
|
+
if (sourceAddress !== void 0 && !isNonEmptyString(sourceAddress))
|
|
60
|
+
return void 0;
|
|
61
|
+
const mode = sourceAddress === void 0 ? "asm" : "ssm";
|
|
62
|
+
const protocol = endpoint["protocol"];
|
|
63
|
+
if (protocol !== void 0 && protocol !== mode)
|
|
64
|
+
return void 0;
|
|
65
|
+
const auth = endpoint["auth"];
|
|
66
|
+
const senderAddress = isObject(auth) ? auth["senderAddress"] : void 0;
|
|
67
|
+
if (mode === "ssm")
|
|
68
|
+
return senderAddress === void 0 ? { mode, source: sourceAddress } : void 0;
|
|
69
|
+
if (auth === void 0)
|
|
70
|
+
return { mode };
|
|
71
|
+
return isNonEmptyString(senderAddress) ? { mode, source: senderAddress } : void 0;
|
|
170
72
|
}
|
|
171
|
-
function
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
73
|
+
function authIssues(auth) {
|
|
74
|
+
const base = "$.multicast.auth";
|
|
75
|
+
const issue = (path, message) => [
|
|
76
|
+
{ code: "multicast_auth", path: `${base}${path}`, message }
|
|
77
|
+
];
|
|
78
|
+
if (!isObject(auth))
|
|
79
|
+
return issue("", "auth must be an object");
|
|
80
|
+
const unknown = Object.keys(auth).filter((key) => !AUTH_MEMBERS.has(key));
|
|
81
|
+
if (unknown.length > 0) {
|
|
82
|
+
return issue("", `auth has unknown member(s) ${unknown.join(", ")}; draft -01 7.2.6 defines scheme, version, sig, keys and minEpoch`);
|
|
83
|
+
}
|
|
84
|
+
if (auth["scheme"] !== "bc-provenance")
|
|
85
|
+
return issue(".scheme", 'scheme must be "bc-provenance"');
|
|
86
|
+
if (auth["version"] !== 2)
|
|
87
|
+
return issue(".version", "version must be 2 (bc-provenance version 2, draft -01 7.2)");
|
|
88
|
+
if (auth["sig"] !== "ed25519")
|
|
89
|
+
return issue(".sig", 'sig must be "ed25519"');
|
|
90
|
+
const keys = auth["keys"];
|
|
91
|
+
if (!Array.isArray(keys) || keys.length < 1 || keys.length > 4) {
|
|
92
|
+
return issue(".keys", "keys must be an array of one to four {kid, publicKey, firstEpoch} objects");
|
|
93
|
+
}
|
|
94
|
+
const kids = /* @__PURE__ */ new Set();
|
|
95
|
+
const firstEpochs = /* @__PURE__ */ new Set();
|
|
96
|
+
for (let index = 0; index < keys.length; index++) {
|
|
97
|
+
const key = keys[index];
|
|
98
|
+
const at = `.keys[${index}]`;
|
|
99
|
+
if (!isObject(key) || Object.keys(key).some((member) => !KEY_MEMBERS.has(member))) {
|
|
100
|
+
return issue(at, "a key is exactly {kid, publicKey, firstEpoch}");
|
|
101
|
+
}
|
|
102
|
+
if (!isIntegerIn(key["kid"], 0, UINT32_MAX))
|
|
103
|
+
return issue(`${at}.kid`, "kid must be an unsigned 32-bit integer");
|
|
104
|
+
if (typeof key["publicKey"] !== "string" || !ED25519_PUBLIC_KEY_BASE64URL.test(key["publicKey"])) {
|
|
105
|
+
return issue(`${at}.publicKey`, "publicKey must be a 32-octet Ed25519 key in canonical unpadded base64url");
|
|
106
|
+
}
|
|
107
|
+
if (!isIntegerIn(key["firstEpoch"], 0, UINT32_MAX)) {
|
|
108
|
+
return issue(`${at}.firstEpoch`, "firstEpoch must be an unsigned 32-bit integer");
|
|
109
|
+
}
|
|
110
|
+
if (kids.has(key["kid"]))
|
|
111
|
+
return issue(`${at}.kid`, `kid ${key["kid"]} is repeated; the catalog holds no key set`);
|
|
112
|
+
if (firstEpochs.has(key["firstEpoch"])) {
|
|
113
|
+
return issue(`${at}.firstEpoch`, `firstEpoch ${key["firstEpoch"]} is repeated; the catalog holds no key set`);
|
|
114
|
+
}
|
|
115
|
+
kids.add(key["kid"]);
|
|
116
|
+
firstEpochs.add(key["firstEpoch"]);
|
|
117
|
+
}
|
|
118
|
+
if (!isIntegerIn(auth["minEpoch"], 0, UINT32_MAX)) {
|
|
119
|
+
return issue(".minEpoch", "minEpoch must be an unsigned 32-bit integer");
|
|
120
|
+
}
|
|
121
|
+
return [];
|
|
175
122
|
}
|
|
176
|
-
function
|
|
177
|
-
|
|
178
|
-
|
|
123
|
+
function endpointAuthIssue(endpoint, mode, at) {
|
|
124
|
+
const auth = endpoint["auth"];
|
|
125
|
+
if (!isObject(auth))
|
|
126
|
+
return { path: `${at}.auth`, message: "auth must be an object" };
|
|
127
|
+
const unknown = Object.keys(auth).filter((key) => !ENDPOINT_AUTH_MEMBERS.has(key));
|
|
128
|
+
if (unknown.length > 0)
|
|
129
|
+
return { path: `${at}.auth`, message: `auth has unknown member(s) ${unknown.join(", ")}` };
|
|
130
|
+
if (!isIntegerIn(auth["manifestPort"], 1, 65535)) {
|
|
131
|
+
return { path: `${at}.auth.manifestPort`, message: "manifestPort must be an integer from 1 to 65535" };
|
|
179
132
|
}
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
if (rawAuth === void 0) {
|
|
183
|
-
if (playerMode === "enforce") {
|
|
184
|
-
throw new Error("[multicast-auth-catalog] player enforce mode requires multicast.auth");
|
|
185
|
-
}
|
|
186
|
-
return void 0;
|
|
133
|
+
if (!isIntegerIn(auth["streamId"], 0, UINT32_MAX)) {
|
|
134
|
+
return { path: `${at}.auth.streamId`, message: "streamId must be an unsigned 32-bit integer" };
|
|
187
135
|
}
|
|
188
|
-
if (
|
|
189
|
-
|
|
136
|
+
if (mode === "ssm" && auth["senderAddress"] !== void 0) {
|
|
137
|
+
return { path: `${at}.auth.senderAddress`, message: "senderAddress must not appear on an SSM endpoint; S is sourceAddress" };
|
|
190
138
|
}
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
throw new Error("[multicast-auth-catalog] catalog tracks must be an array");
|
|
139
|
+
if (mode === "asm" && !isNonEmptyString(auth["senderAddress"])) {
|
|
140
|
+
return { path: `${at}.auth.senderAddress`, message: "a protected ASM endpoint requires senderAddress" };
|
|
194
141
|
}
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
})
|
|
142
|
+
if (auth["maxAuthDelayMs"] !== void 0 && !isIntegerIn(auth["maxAuthDelayMs"], 50, 1e3)) {
|
|
143
|
+
return { path: `${at}.auth.maxAuthDelayMs`, message: "maxAuthDelayMs must be an integer from 50 to 1000" };
|
|
144
|
+
}
|
|
145
|
+
if (auth["manifestTimerMs"] !== void 0 && !isIntegerIn(auth["manifestTimerMs"], 1, Number.MAX_SAFE_INTEGER)) {
|
|
146
|
+
return { path: `${at}.auth.manifestTimerMs`, message: "manifestTimerMs must be an integer of at least 1" };
|
|
147
|
+
}
|
|
148
|
+
if (auth["manifestTrack"] !== void 0 && !isNonEmptyString(auth["manifestTrack"])) {
|
|
149
|
+
return { path: `${at}.auth.manifestTrack`, message: "manifestTrack must be a non-empty string" };
|
|
150
|
+
}
|
|
151
|
+
if (!isIntegerIn(endpoint["bandwidth"], 1, Number.MAX_SAFE_INTEGER)) {
|
|
152
|
+
return { path: `${at}.bandwidth`, message: "a protected endpoint requires bandwidth, which bounds the receiver's hold queues" };
|
|
153
|
+
}
|
|
154
|
+
return void 0;
|
|
155
|
+
}
|
|
156
|
+
var CATALOG_NAMESPACE = /* @__PURE__ */ Symbol.for("@blockcast/mmt-base/catalogNamespace");
|
|
157
|
+
function multicastCatalogIssues(catalog, options = {}) {
|
|
158
|
+
if (!isObject(catalog))
|
|
159
|
+
return [];
|
|
160
|
+
const issues = [];
|
|
161
|
+
if ("multicast.auth" in catalog) {
|
|
162
|
+
issues.push({
|
|
163
|
+
code: "multicast_auth",
|
|
164
|
+
path: '$["multicast.auth"]',
|
|
165
|
+
message: 'the root "multicast.auth" key is retired; declare auth as multicast.auth (draft -01 7.2.6)'
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
const multicast = catalog["multicast"];
|
|
169
|
+
if (!isObject(multicast))
|
|
170
|
+
return issues;
|
|
171
|
+
const protectedCatalog = multicast["auth"] !== void 0;
|
|
172
|
+
if (protectedCatalog)
|
|
173
|
+
issues.push(...authIssues(multicast["auth"]));
|
|
174
|
+
const endpoints = multicast["endpoints"];
|
|
175
|
+
if (!Array.isArray(endpoints))
|
|
176
|
+
return issues;
|
|
177
|
+
const tracks = Array.isArray(catalog["tracks"]) ? catalog["tracks"] : [];
|
|
178
|
+
const namespaceOf = /* @__PURE__ */ new Map();
|
|
179
|
+
for (const track of tracks) {
|
|
180
|
+
if (isObject(track) && typeof track["name"] === "string")
|
|
181
|
+
namespaceOf.set(track["name"], track["namespace"]);
|
|
182
|
+
}
|
|
183
|
+
const tagged = catalog[CATALOG_NAMESPACE];
|
|
184
|
+
let referenceNamespace = options.catalogNamespace ?? (typeof tagged === "string" ? tagged : void 0);
|
|
185
|
+
const sources = [];
|
|
186
|
+
for (let index = 0; index < endpoints.length; index++) {
|
|
187
|
+
const endpoint = endpoints[index];
|
|
188
|
+
const at = `$.multicast.endpoints[${index}]`;
|
|
189
|
+
const fail = (code, path, message) => {
|
|
190
|
+
issues.push({ code, path, message, endpointIndex: index });
|
|
191
|
+
};
|
|
192
|
+
sources.push(void 0);
|
|
193
|
+
if (!isObject(endpoint)) {
|
|
194
|
+
fail("multicast_endpoint", at, "endpoint must be an object");
|
|
195
|
+
continue;
|
|
196
|
+
}
|
|
197
|
+
const protocol = endpoint["protocol"];
|
|
198
|
+
if (protocol !== void 0 && protocol !== "ssm" && protocol !== "asm") {
|
|
199
|
+
fail("multicast_endpoint", `${at}.protocol`, `protocol must be "ssm" or "asm"; a bearer such as ${JSON.stringify(protocol)} is a networkSource entry (draft -01 4.2)`);
|
|
200
|
+
continue;
|
|
201
|
+
}
|
|
202
|
+
const hasAuth = endpoint["auth"] !== void 0;
|
|
203
|
+
if (protectedCatalog !== hasAuth) {
|
|
204
|
+
fail("multicast_endpoint_auth", `${at}.auth`, protectedCatalog ? "every endpoint requires auth when multicast carries auth; a receiver ignores this endpoint" : "auth names no key without multicast.auth; a receiver ignores this endpoint");
|
|
205
|
+
continue;
|
|
206
|
+
}
|
|
207
|
+
const sourceAddress = endpoint["sourceAddress"];
|
|
208
|
+
if (sourceAddress !== void 0 && !isNonEmptyString(sourceAddress)) {
|
|
209
|
+
fail("multicast_endpoint", `${at}.sourceAddress`, "sourceAddress must be a non-empty string");
|
|
210
|
+
continue;
|
|
211
|
+
}
|
|
212
|
+
const mode = sourceAddress === void 0 ? "asm" : "ssm";
|
|
213
|
+
if (protocol !== void 0 && protocol !== mode) {
|
|
214
|
+
fail("multicast_endpoint", `${at}.protocol`, `protocol ${JSON.stringify(protocol)} disagrees with sourceAddress, which selects ${mode}`);
|
|
215
|
+
continue;
|
|
216
|
+
}
|
|
217
|
+
if (!isIntegerIn(endpoint["port"], 1, 65535)) {
|
|
218
|
+
fail("multicast_endpoint", `${at}.port`, "port must be an integer from 1 to 65535");
|
|
219
|
+
continue;
|
|
220
|
+
}
|
|
221
|
+
if (hasAuth) {
|
|
222
|
+
const authIssue = endpointAuthIssue(endpoint, mode, at);
|
|
223
|
+
if (authIssue) {
|
|
224
|
+
fail("multicast_endpoint_auth", authIssue.path, authIssue.message);
|
|
225
|
+
continue;
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
sources[index] = multicastEndpointSource(endpoint);
|
|
229
|
+
const refs = Array.isArray(endpoint["tracks"]) ? endpoint["tracks"] : [];
|
|
230
|
+
for (let refIndex = 0; refIndex < refs.length; refIndex++) {
|
|
231
|
+
const ref = refs[refIndex];
|
|
232
|
+
const name = isObject(ref) ? ref["name"] : ref;
|
|
233
|
+
if (typeof name !== "string")
|
|
234
|
+
continue;
|
|
235
|
+
const namespace = namespaceOf.get(name);
|
|
236
|
+
if (typeof namespace !== "string")
|
|
237
|
+
continue;
|
|
238
|
+
referenceNamespace ??= namespace;
|
|
239
|
+
if (namespace !== referenceNamespace) {
|
|
240
|
+
fail("multicast_track", `${at}.tracks[${refIndex}].name`, `track ${JSON.stringify(name)} declares namespace ${JSON.stringify(namespace)}, not the catalog track's ${JSON.stringify(referenceNamespace)}`);
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
const tupleOf = (index) => {
|
|
245
|
+
const endpoint = endpoints[index];
|
|
246
|
+
const auth = endpoint["auth"];
|
|
247
|
+
return {
|
|
248
|
+
sg: JSON.stringify([sources[index].source ?? null, endpoint["groupAddress"]]),
|
|
249
|
+
port: endpoint["port"],
|
|
250
|
+
manifestPort: isObject(auth) ? auth["manifestPort"] : void 0
|
|
251
|
+
};
|
|
220
252
|
};
|
|
253
|
+
for (let index = 0; index < endpoints.length; index++) {
|
|
254
|
+
if (!sources[index])
|
|
255
|
+
continue;
|
|
256
|
+
const own = tupleOf(index);
|
|
257
|
+
const at = `$.multicast.endpoints[${index}]`;
|
|
258
|
+
if (own.manifestPort !== void 0 && own.manifestPort === own.port) {
|
|
259
|
+
issues.push({ code: "multicast_endpoint_auth", path: `${at}.auth.manifestPort`, message: "manifestPort must differ from the endpoint's own port", endpointIndex: index });
|
|
260
|
+
continue;
|
|
261
|
+
}
|
|
262
|
+
for (let other = 0; other < endpoints.length; other++) {
|
|
263
|
+
if (other === index || !sources[other])
|
|
264
|
+
continue;
|
|
265
|
+
const peer = tupleOf(other);
|
|
266
|
+
if (peer.sg !== own.sg)
|
|
267
|
+
continue;
|
|
268
|
+
if (peer.port === own.port) {
|
|
269
|
+
issues.push({ code: "multicast_endpoint", path: `${at}.port`, message: `(S, G, port) is shared with endpoint ${other}; one endpoint object per multicast tuple`, endpointIndex: index });
|
|
270
|
+
break;
|
|
271
|
+
}
|
|
272
|
+
if (own.manifestPort !== void 0 && (own.manifestPort === peer.port || own.manifestPort === peer.manifestPort)) {
|
|
273
|
+
issues.push({ code: "multicast_endpoint_auth", path: `${at}.auth.manifestPort`, message: `manifestPort is a port or manifestPort of endpoint ${other} on the same (S, G)`, endpointIndex: index });
|
|
274
|
+
break;
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
return issues;
|
|
221
279
|
}
|
|
222
280
|
|
|
223
281
|
// src/repair-layers.ts
|
|
@@ -227,6 +285,7 @@ var DEFAULT_REPAIR_PRIORITY = 240;
|
|
|
227
285
|
var MAX_RAPTORQ_SOURCE_SYMBOLS = 56403;
|
|
228
286
|
var MAX_REPAIR_SYMBOLS = 16777215;
|
|
229
287
|
var MAX_ENCODING_SYMBOL_ID = 16777215;
|
|
288
|
+
var MAX_REED_SOLOMON_BLOCK_SYMBOLS = 255;
|
|
230
289
|
var RepairContractError = class extends Error {
|
|
231
290
|
constructor(code, path, message) {
|
|
232
291
|
super(`[repair-layers:${code}] ${path}: ${message}`);
|
|
@@ -409,11 +468,12 @@ function assembleRepairLayers(source, descriptors, fail = throwRepairContractErr
|
|
|
409
468
|
if (layered && !positiveInteger(source.sourceSymbols)) {
|
|
410
469
|
fail("track_fec", `${source.path}.sourceSymbols`, "layered or overlay repair needs a positive integer sourceSymbols on the source");
|
|
411
470
|
}
|
|
412
|
-
|
|
471
|
+
const reedSolomon = source.algorithm === "reed-solomon";
|
|
472
|
+
if (layered && source.algorithm !== "raptorq" && !reedSolomon) {
|
|
413
473
|
fail(
|
|
414
474
|
"track_fec",
|
|
415
475
|
`${source.path}.algorithm`,
|
|
416
|
-
"repair layers and overlays are defined only for raptorq
|
|
476
|
+
"repair layers and overlays are defined only for raptorq and reed-solomon (draft-ramadan-moq-fec-01 6.3.4 rule 7)"
|
|
417
477
|
);
|
|
418
478
|
}
|
|
419
479
|
let layerZeroPriority = DEFAULT_REPAIR_PRIORITY;
|
|
@@ -472,6 +532,13 @@ function assembleRepairLayers(source, descriptors, fail = throwRepairContractErr
|
|
|
472
532
|
`overlay sourceSymbols + repairSymbols - 1 exceeds the 24-bit ESI space (${MAX_ENCODING_SYMBOL_ID})`
|
|
473
533
|
);
|
|
474
534
|
}
|
|
535
|
+
if (reedSolomon && sourceSymbols + repairSymbols > MAX_REED_SOLOMON_BLOCK_SYMBOLS) {
|
|
536
|
+
fail(
|
|
537
|
+
"track_fec_bounds",
|
|
538
|
+
`${d.path}.repairSymbols`,
|
|
539
|
+
`reed-solomon overlay sourceSymbols + repairSymbols exceeds ${MAX_REED_SOLOMON_BLOCK_SYMBOLS} (draft-ramadan-moq-fec-01 6.3.4 rule 12)`
|
|
540
|
+
);
|
|
541
|
+
}
|
|
475
542
|
overlays.push({ repairTrackName: d.name, scope: "keyframe", sourceSymbols, repairSymbols, priority: d.priority });
|
|
476
543
|
}
|
|
477
544
|
let offset = layerZeroSymbols;
|
|
@@ -516,6 +583,13 @@ function assembleRepairLayers(source, descriptors, fail = throwRepairContractErr
|
|
|
516
583
|
`sourceSymbols + total base repair symbols - 1 exceeds the 24-bit ESI space (${MAX_ENCODING_SYMBOL_ID})`
|
|
517
584
|
);
|
|
518
585
|
}
|
|
586
|
+
if (reedSolomon && k + totalBaseRepairSymbols > MAX_REED_SOLOMON_BLOCK_SYMBOLS) {
|
|
587
|
+
fail(
|
|
588
|
+
"track_fec_bounds",
|
|
589
|
+
`${source.path}.sourceSymbols`,
|
|
590
|
+
`reed-solomon sourceSymbols + total base repair symbols exceeds ${MAX_REED_SOLOMON_BLOCK_SYMBOLS} (draft-ramadan-moq-fec-01 6.3.4 rule 12)`
|
|
591
|
+
);
|
|
592
|
+
}
|
|
519
593
|
return { sourceTrackName: source.name, baseLayers, overlays, totalBaseRepairSymbols };
|
|
520
594
|
}
|
|
521
595
|
|
|
@@ -577,7 +651,7 @@ function isFecCatalogGeometry(obj) {
|
|
|
577
651
|
const o = obj;
|
|
578
652
|
const algorithm = o["algorithm"];
|
|
579
653
|
const symbolSize = o["symbolSize"];
|
|
580
|
-
return typeof algorithm === "string" &&
|
|
654
|
+
return typeof algorithm === "string" && algorithm.length > 0 && typeof o["sourceSymbols"] === "number" && o["sourceSymbols"] >= 1 && typeof o["repairSymbols"] === "number" && o["repairSymbols"] >= 1 && typeof symbolSize === "number" && symbolSize >= 1 && (algorithm !== "raptorq" || symbolSize % 8 === 0) && typeof o["repairTrack"] === "string" && o["repairTrack"].length > 0;
|
|
581
655
|
}
|
|
582
656
|
function isFecCatalogConfig(obj) {
|
|
583
657
|
if (!isFecCatalogGeometry(obj)) return false;
|
|
@@ -592,8 +666,7 @@ function isMulticastTrackObject(obj) {
|
|
|
592
666
|
function isMulticastEndpoint(obj) {
|
|
593
667
|
if (typeof obj !== "object" || obj === null) return false;
|
|
594
668
|
const o = obj;
|
|
595
|
-
|
|
596
|
-
return typeof protocol === "string" && (protocol === "ssm" || protocol === "asm" || protocol === "amt" || protocol === "atsc3") && typeof o["groupAddress"] === "string" && o["groupAddress"].length > 0 && typeof o["port"] === "number" && o["port"] > 0 && o["port"] <= 65535 && Array.isArray(o["tracks"]) && o["tracks"].every((t) => typeof t === "string" || isMulticastTrackObject(t));
|
|
669
|
+
return multicastEndpointSource(o) !== void 0 && typeof o["groupAddress"] === "string" && o["groupAddress"].length > 0 && typeof o["port"] === "number" && o["port"] > 0 && o["port"] <= 65535 && Array.isArray(o["tracks"]) && o["tracks"].every((t) => typeof t === "string" || isMulticastTrackObject(t));
|
|
597
670
|
}
|
|
598
671
|
function isMulticastCatalogConfig(obj) {
|
|
599
672
|
if (typeof obj !== "object" || obj === null) return false;
|
|
@@ -697,7 +770,7 @@ var CmsfCatalogValidationError = class extends Error {
|
|
|
697
770
|
function catalogError(code, path, message) {
|
|
698
771
|
throw new CmsfCatalogValidationError(code, path, message);
|
|
699
772
|
}
|
|
700
|
-
function validateCmsfMmtpCatalog(value) {
|
|
773
|
+
function validateCmsfMmtpCatalog(value, options = {}) {
|
|
701
774
|
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
702
775
|
catalogError("catalog_object", "$", "catalog must be an object");
|
|
703
776
|
}
|
|
@@ -718,6 +791,22 @@ function validateCmsfMmtpCatalog(value) {
|
|
|
718
791
|
"commonTrackFields is retired; every track carries its own fields"
|
|
719
792
|
);
|
|
720
793
|
}
|
|
794
|
+
const initDataList = catalog["initDataList"];
|
|
795
|
+
if (initDataList !== void 0) {
|
|
796
|
+
if (!Array.isArray(initDataList)) {
|
|
797
|
+
catalogError("catalog_init_data_list", "$.initDataList", "initDataList must be an array");
|
|
798
|
+
}
|
|
799
|
+
initDataList.forEach((entry, i) => {
|
|
800
|
+
const e = entry;
|
|
801
|
+
const entryPath = `$.initDataList[${i}]`;
|
|
802
|
+
if (typeof e !== "object" || e === null || Array.isArray(e) || typeof e["id"] !== "string" || e["id"].length === 0 || typeof e["type"] !== "string" || e["type"].length === 0) {
|
|
803
|
+
catalogError("catalog_init_data_list", entryPath, "entry needs a non-empty string id and type");
|
|
804
|
+
}
|
|
805
|
+
if (e["type"] === "inline" && (typeof e["data"] !== "string" || e["data"].length === 0)) {
|
|
806
|
+
catalogError("catalog_init_data_list", `${entryPath}.data`, 'an "inline" entry needs non-empty data');
|
|
807
|
+
}
|
|
808
|
+
});
|
|
809
|
+
}
|
|
721
810
|
const tracks = catalog["tracks"];
|
|
722
811
|
const trackRecords = [];
|
|
723
812
|
const positiveInteger2 = (input) => Number.isSafeInteger(input) && input > 0;
|
|
@@ -769,6 +858,14 @@ function validateCmsfMmtpCatalog(value) {
|
|
|
769
858
|
if (keyframeIntervalMs !== void 0 && !positiveNumber(keyframeIntervalMs) || keyframeIntervalTicks !== void 0 && !positiveInteger2(keyframeIntervalTicks)) {
|
|
770
859
|
catalogError("track_keyframe_interval", path, "keyframe interval fields must be positive numbers");
|
|
771
860
|
}
|
|
861
|
+
const anchor = track["presentationAnchorTicks"];
|
|
862
|
+
if (anchor !== void 0 && !Number.isSafeInteger(anchor)) {
|
|
863
|
+
catalogError("track_presentation_anchor", `${path}.presentationAnchorTicks`, "must be a safe integer");
|
|
864
|
+
}
|
|
865
|
+
const initRef = track["initRef"];
|
|
866
|
+
if (initRef !== void 0 && (typeof initRef !== "string" || initRef.length === 0)) {
|
|
867
|
+
catalogError("track_init_ref", `${path}.initRef`, "must be a non-empty string");
|
|
868
|
+
}
|
|
772
869
|
if (packaging === "fec-repair") {
|
|
773
870
|
rejectRepairTrackGeometry(path, track, catalogError);
|
|
774
871
|
validateRepairTrackFields(describeRepairTrack(name, path, track), catalogError);
|
|
@@ -776,9 +873,8 @@ function validateCmsfMmtpCatalog(value) {
|
|
|
776
873
|
rejectRepairFieldsOnMediaTrack(path, track, catalogError);
|
|
777
874
|
}
|
|
778
875
|
if (packaging === "mmtp") {
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
catalogError("track_mmtp_mode", `${path}.mmtpMode`, "must be mpu or mfu");
|
|
876
|
+
if (track["mmtpMode"] !== "mfu") {
|
|
877
|
+
catalogError("track_mmtp_mode", `${path}.mmtpMode`, "must be mfu");
|
|
782
878
|
}
|
|
783
879
|
if (!positiveInteger2(timescale)) {
|
|
784
880
|
catalogError("track_timescale", `${path}.timescale`, "must be a positive integer");
|
|
@@ -801,8 +897,8 @@ function validateCmsfMmtpCatalog(value) {
|
|
|
801
897
|
}
|
|
802
898
|
const config = fec;
|
|
803
899
|
const algorithm = config["algorithm"];
|
|
804
|
-
if (
|
|
805
|
-
catalogError("track_fec", `${path}.fec.algorithm`, "
|
|
900
|
+
if (typeof algorithm !== "string" || algorithm.length === 0) {
|
|
901
|
+
catalogError("track_fec", `${path}.fec.algorithm`, "must be a non-empty string");
|
|
806
902
|
}
|
|
807
903
|
if ("interleaveDepth" in config || "interleaveMs" in config) {
|
|
808
904
|
catalogError("track_fec", `${path}.fec`, "interleaveDepthMs is the only supported interleave field");
|
|
@@ -831,6 +927,9 @@ function validateCmsfMmtpCatalog(value) {
|
|
|
831
927
|
}
|
|
832
928
|
}
|
|
833
929
|
readFecBlockProfile(config["blockProfile"], `${path}.fec.blockProfile`, algorithm !== "none", catalogError);
|
|
930
|
+
if (algorithm !== "none" && config["symbolSize"] < ISO_SSBG1_MIN_SYMBOL_SIZE) {
|
|
931
|
+
catalogError("track_fec", `${path}.fec.symbolSize`, "iso-ssbg1-v1 symbolSize must be at least 14");
|
|
932
|
+
}
|
|
834
933
|
}
|
|
835
934
|
}
|
|
836
935
|
const repairDescriptors = trackRecords.flatMap(
|
|
@@ -942,15 +1041,8 @@ function validateCmsfMmtpCatalog(value) {
|
|
|
942
1041
|
}
|
|
943
1042
|
}
|
|
944
1043
|
}
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
} catch (error) {
|
|
948
|
-
catalogError(
|
|
949
|
-
"multicast_auth",
|
|
950
|
-
"$.multicast.auth",
|
|
951
|
-
error instanceof Error ? error.message : "invalid multicast.auth v2 block"
|
|
952
|
-
);
|
|
953
|
-
}
|
|
1044
|
+
const [multicastIssue] = multicastCatalogIssues(catalog, options);
|
|
1045
|
+
if (multicastIssue) catalogError(multicastIssue.code, multicastIssue.path, multicastIssue.message);
|
|
954
1046
|
validateArchive(catalog);
|
|
955
1047
|
return catalog;
|
|
956
1048
|
}
|
|
@@ -976,7 +1068,7 @@ function resolveGroupDurationTicks(timing, timescale) {
|
|
|
976
1068
|
const product = timing.groupDurationMs * timescale;
|
|
977
1069
|
if (product % 1e3 !== 0) {
|
|
978
1070
|
throw new Error(
|
|
979
|
-
`[carp-catalog] resolveGroupDurationTicks: groupDurationMs=${timing.groupDurationMs} at timescale=${timescale} produces non-integer ticks (${product / 1e3}); publisher must use groupDurationTicks override (mmt-
|
|
1071
|
+
`[carp-catalog] resolveGroupDurationTicks: groupDurationMs=${timing.groupDurationMs} at timescale=${timescale} produces non-integer ticks (${product / 1e3}); publisher must use groupDurationTicks override (mmt-01 \xA74.4.2)`
|
|
980
1072
|
);
|
|
981
1073
|
}
|
|
982
1074
|
return product / 1e3;
|