@blockcast/mmt-container 0.4.0 → 0.4.1-main.30f0611c24e8
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 +36 -20
- 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 +1904 -692
- package/dist/browser-runtime.js.map +4 -4
- package/dist/carp-catalog.d.ts +76 -39
- package/dist/carp-catalog.d.ts.map +1 -1
- package/dist/carp-catalog.js +321 -205
- 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 +28 -7
- 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/cmcd-producer.d.ts +8 -0
- package/dist/cmcd-producer.d.ts.map +1 -1
- package/dist/cmcd-producer.js +14 -0
- package/dist/cmcd-producer.js.map +2 -2
- package/dist/delivery-catalog.js +98 -234
- package/dist/delivery-catalog.js.map +4 -4
- package/dist/fec-manager.d.ts +108 -1
- package/dist/fec-manager.d.ts.map +1 -1
- package/dist/fec-manager.js +452 -66
- package/dist/fec-manager.js.map +4 -4
- 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 +10 -0
- package/dist/fec-worker-setup.d.ts.map +1 -1
- package/dist/fec-worker-setup.js +15 -4
- package/dist/fec-worker-setup.js.map +2 -2
- package/dist/held-layer-admission.d.ts +58 -0
- package/dist/held-layer-admission.d.ts.map +1 -0
- package/dist/held-layer-admission.js +105 -0
- package/dist/held-layer-admission.js.map +7 -0
- 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 +39 -1
- package/dist/iso-block-locator.d.ts.map +1 -1
- package/dist/iso-block-locator.js +109 -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 +21 -13
- package/dist/mfu-reassembler.js.map +2 -2
- package/dist/mmtp-container-parser.d.ts.map +1 -1
- package/dist/mmtp-container-parser.js +93 -22
- package/dist/mmtp-container-parser.js.map +2 -2
- package/dist/mmtp-container-parser.no-modules.js +1250 -317
- package/dist/mmtp-container-parser.no-modules.js.map +4 -4
- package/dist/mmtp-decode-pipeline.js +93 -22
- package/dist/mmtp-decode-pipeline.js.map +2 -2
- package/dist/mmtp-fec-session.d.ts +192 -0
- package/dist/mmtp-fec-session.d.ts.map +1 -0
- package/dist/mmtp-fec-session.js +640 -0
- package/dist/mmtp-fec-session.js.map +7 -0
- package/dist/mmtp-router.d.ts +39 -6
- package/dist/mmtp-router.d.ts.map +1 -1
- package/dist/mmtp-router.js +184 -27
- 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 +31 -8
- package/dist/multicast-input.d.ts.map +1 -1
- package/dist/multicast-input.js +299 -35
- package/dist/multicast-input.js.map +3 -3
- package/dist/multicast-manager.d.ts +94 -5
- package/dist/multicast-manager.d.ts.map +1 -1
- package/dist/multicast-manager.js +908 -357
- package/dist/multicast-manager.js.map +4 -4
- package/dist/multicast-transport.d.ts +12 -2
- package/dist/multicast-transport.d.ts.map +1 -1
- package/dist/multicast-transport.js +108 -238
- package/dist/multicast-transport.js.map +4 -4
- package/dist/multicast-unwrap.js +21 -13
- 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 +1195 -301
- 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/sample-combiner.d.ts +7 -1
- package/dist/sample-combiner.d.ts.map +1 -1
- package/dist/sample-combiner.js +14 -2
- package/dist/sample-combiner.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 +21 -13
- package/dist/timestamp-codec.js.map +2 -2
- package/dist/wasm-mfu-reassembler.js.map +1 -1
- package/dist/wasm-mmtp-container-parser.js +93 -22
- package/dist/wasm-mmtp-container-parser.js.map +2 -2
- package/package.json +6 -9
- package/schemas/catalog.schema.json +133 -38
- package/src/align.ts +52 -21
- package/src/carp-catalog.ts +188 -68
- package/src/catalog-fec-params.ts +28 -3
- package/src/catalog-network-source.ts +49 -7
- package/src/catalog-validator.ts +4 -11
- package/src/cmcd-producer.ts +17 -0
- package/src/fec-manager.ts +366 -63
- package/src/fec-state.ts +11 -4
- package/src/fec-worker-setup.ts +30 -2
- package/src/held-layer-admission.ts +161 -0
- package/src/index.ts +27 -10
- package/src/iso-block-locator.ts +110 -7
- package/src/manifest-auth-plan.ts +39 -91
- package/src/mmtp-container-parser.ts +75 -7
- package/src/mmtp-fec-session.ts +606 -0
- package/src/mmtp-router.ts +166 -7
- package/src/multicast-auth-catalog.ts +131 -238
- package/src/multicast-input.ts +148 -124
- package/src/multicast-manager.ts +267 -21
- package/src/multicast-transport.ts +17 -3
- 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/sample-combiner.ts +15 -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 +71 -4
- 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-amt-driad-with-relay.json +38 -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 +3 -3
- 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 +31 -1
- package/test-vectors/catalog-multicast-auth-v1.json +38 -20
- package/test-vectors/catalog-validation.json +101 -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
|
@@ -12,10 +12,15 @@
|
|
|
12
12
|
|
|
13
13
|
import { DEFAULT_AMT_RELAY_PORT } from "@blockcast/mmt-base";
|
|
14
14
|
|
|
15
|
-
/** One `networkSource[]` entry as published (`{type, discovery?, relay, port?}`). */
|
|
15
|
+
/** One `networkSource[]` entry as published (AMT `{type, discovery?, relay, port?}` or ATSC3). */
|
|
16
16
|
export type CatalogNetworkSource = {
|
|
17
17
|
type?: string;
|
|
18
|
-
/**
|
|
18
|
+
/** ATSC3: RF centre frequency in kHz (draft -01 4.2.2). */
|
|
19
|
+
frequency?: number;
|
|
20
|
+
plpId?: number;
|
|
21
|
+
serviceId?: number;
|
|
22
|
+
slsUri?: string;
|
|
23
|
+
/** `"dns"`, `"manual"` (or absent) name a dialable relay; `"driad"` resolves at runtime. */
|
|
19
24
|
discovery?: string;
|
|
20
25
|
relay?: string;
|
|
21
26
|
port?: number;
|
|
@@ -48,11 +53,10 @@ function normalizePort(value: unknown): number | undefined {
|
|
|
48
53
|
* and a non-blank relay, or `undefined` when the catalog advertises none —
|
|
49
54
|
* callers fall back to native multicast (or their own explicit relay config).
|
|
50
55
|
*
|
|
51
|
-
* A `discovery: "driad"` entry is skipped even when it names a `relay
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
* catalog that asked for DRIAD into a manual join against an unroutable name.
|
|
56
|
+
* A `discovery: "driad"` entry is skipped even when it names a `relay`. Draft
|
|
57
|
+
* -01 4.2.1 forbids that shape and `validateCmsfMmtpCatalog` rejects it, but
|
|
58
|
+
* this reader stays tolerant: returning it would turn a catalog that asked
|
|
59
|
+
* for DRIAD into a manual join against an unroutable name.
|
|
56
60
|
* `findAmtRelay` in `@blockcast/mmt-transport` applies the same rule — the two
|
|
57
61
|
* readers of one field must agree on which entries are dialable.
|
|
58
62
|
*
|
|
@@ -72,3 +76,41 @@ export function catalogAmtNetworkSource(networkSource: unknown): AmtNetworkSourc
|
|
|
72
76
|
}
|
|
73
77
|
return undefined;
|
|
74
78
|
}
|
|
79
|
+
|
|
80
|
+
/** Resolved ATSC 3.0 tuning (draft -01 4.2.2/4.2.3). Only `frequency` is REQUIRED. */
|
|
81
|
+
export type Atsc3NetworkSource = {
|
|
82
|
+
/** RF centre frequency in kHz. */
|
|
83
|
+
frequency: number;
|
|
84
|
+
plpId?: number;
|
|
85
|
+
serviceId?: number;
|
|
86
|
+
/** SLS of the MMTP service; libmmt does not fetch it. */
|
|
87
|
+
slsUri?: string;
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
function intIn(value: unknown, min: number, max: number): value is number {
|
|
91
|
+
return Number.isInteger(value) && (value as number) >= min && (value as number) <= max;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Resolve ATSC 3.0 tuning from a catalog `networkSource` (array or bare-object
|
|
96
|
+
* form): the first `type: "atsc3"` entry with a positive integer `frequency`
|
|
97
|
+
* (kHz). Optional fields are carried only when in range; an entry with no
|
|
98
|
+
* usable frequency is skipped, since it names nothing a tuner can lock to.
|
|
99
|
+
* Draft -01 3 puts the tuner first, so callers prefer this over AMT.
|
|
100
|
+
*/
|
|
101
|
+
export function catalogAtsc3NetworkSource(networkSource: unknown): Atsc3NetworkSource | undefined {
|
|
102
|
+
const entries = Array.isArray(networkSource) ? networkSource : networkSource ? [networkSource] : [];
|
|
103
|
+
for (const raw of entries) {
|
|
104
|
+
if (!raw || typeof raw !== "object") continue;
|
|
105
|
+
const ns = raw as CatalogNetworkSource;
|
|
106
|
+
if (ns.type !== "atsc3" || !intIn(ns.frequency, 1, Number.MAX_SAFE_INTEGER)) continue;
|
|
107
|
+
const slsUri = typeof ns.slsUri === "string" ? ns.slsUri.trim() : "";
|
|
108
|
+
return {
|
|
109
|
+
frequency: ns.frequency,
|
|
110
|
+
...(intIn(ns.plpId, 0, 63) ? { plpId: ns.plpId } : {}),
|
|
111
|
+
...(intIn(ns.serviceId, 0, 65535) ? { serviceId: ns.serviceId } : {}),
|
|
112
|
+
...(slsUri ? { slsUri } : {}),
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
return undefined;
|
|
116
|
+
}
|
package/src/catalog-validator.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import Ajv2020 from 'ajv/dist/2020.js'
|
|
2
2
|
import addFormats from 'ajv-formats'
|
|
3
|
-
import { hasUniqueMulticastAuthTrackBindings } from './multicast-auth-catalog.js'
|
|
4
3
|
|
|
5
4
|
export interface CatalogSchemaValidationError {
|
|
6
5
|
instancePath: string
|
|
@@ -16,19 +15,13 @@ export interface CatalogSchemaValidator {
|
|
|
16
15
|
}
|
|
17
16
|
|
|
18
17
|
/**
|
|
19
|
-
* Compile the published catalog schema
|
|
20
|
-
*
|
|
21
|
-
*
|
|
18
|
+
* Compile the published catalog schema the way the package tests it: strict
|
|
19
|
+
* 2020-12 with formats. The schema carries no package-defined keyword; the
|
|
20
|
+
* cross-object rules JSON Schema cannot state (repeated `kid`/`firstEpoch`,
|
|
21
|
+
* port clashes, foreign-namespace tracks) are `validateCmsfMmtpCatalog`'s.
|
|
22
22
|
*/
|
|
23
23
|
export function createCatalogSchemaValidator(schema: object): CatalogSchemaValidator {
|
|
24
24
|
const ajv = new Ajv2020({ allErrors: true, strict: true })
|
|
25
25
|
addFormats(ajv)
|
|
26
|
-
ajv.addKeyword({
|
|
27
|
-
keyword: 'uniqueMulticastAuthTrackBindings',
|
|
28
|
-
type: 'array',
|
|
29
|
-
schemaType: 'boolean',
|
|
30
|
-
validate: (enabled: boolean, tracks: unknown[]) =>
|
|
31
|
-
!enabled || hasUniqueMulticastAuthTrackBindings(tracks),
|
|
32
|
-
})
|
|
33
26
|
return ajv.compile(schema) as CatalogSchemaValidator
|
|
34
27
|
}
|
package/src/cmcd-producer.ts
CHANGED
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
|
|
16
16
|
import type { FecTrackStats } from '@blockcast/fec-worker'
|
|
17
17
|
import type { ManifestVerificationStats } from '@blockcast/mmt-manifest-verify'
|
|
18
|
+
import type { FecFailClosedReason } from './fec-manager.js'
|
|
18
19
|
|
|
19
20
|
// ---------------------------------------------------------------------------
|
|
20
21
|
// Types
|
|
@@ -153,6 +154,7 @@ export class CmcdProducer {
|
|
|
153
154
|
#deltaFailRate: number | null = null
|
|
154
155
|
#switchMiscount = 0
|
|
155
156
|
#manifestStats: ManifestVerificationStats | null = null
|
|
157
|
+
#fecFailClosed: FecFailClosedReason | null = null
|
|
156
158
|
|
|
157
159
|
constructor(options: CmcdProducerOptions) {
|
|
158
160
|
this.#onCmcdParams = options.onCmcdParams
|
|
@@ -200,6 +202,16 @@ export class CmcdProducer {
|
|
|
200
202
|
this.#switchMiscount += 1
|
|
201
203
|
}
|
|
202
204
|
|
|
205
|
+
/**
|
|
206
|
+
* Record that FEC failed closed at runtime (fec-01 6.3.9). Every later
|
|
207
|
+
* snapshot carries `x-bc-fec-fail-closed` (the reason code) and
|
|
208
|
+
* `x-bc-fec-fail-layer` (the held layer i whose total B_i was undercut), so a
|
|
209
|
+
* stream playing without FEC is told apart from one with no loss.
|
|
210
|
+
*/
|
|
211
|
+
updateFecFailClosed(reason: FecFailClosedReason): void {
|
|
212
|
+
this.#fecFailClosed = reason
|
|
213
|
+
}
|
|
214
|
+
|
|
203
215
|
updateManifestVerification(stats: ManifestVerificationStats): void {
|
|
204
216
|
this.#manifestStats = stats
|
|
205
217
|
}
|
|
@@ -248,6 +260,11 @@ export class CmcdProducer {
|
|
|
248
260
|
params['x-bc-play-mode'] = this.#playMode
|
|
249
261
|
}
|
|
250
262
|
|
|
263
|
+
if (this.#fecFailClosed) {
|
|
264
|
+
params['x-bc-fec-fail-closed'] = this.#fecFailClosed.code
|
|
265
|
+
params['x-bc-fec-fail-layer'] = this.#fecFailClosed.layer
|
|
266
|
+
}
|
|
267
|
+
|
|
251
268
|
// Delta-fail-rate is only meaningful when a delta track exists.
|
|
252
269
|
if (
|
|
253
270
|
this.#playMode !== null &&
|