@blockcast/mmt-container 0.4.0-main.d6f2737828fc → 0.4.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.
- package/README.md +12 -9
- package/dist/browser-runtime.js +14219 -13716
- package/dist/browser-runtime.js.map +4 -4
- package/dist/carp-catalog.d.ts +1 -12
- package/dist/carp-catalog.d.ts.map +1 -1
- package/dist/carp-catalog.js +14 -6
- package/dist/carp-catalog.js.map +4 -4
- package/dist/catalog-fec-params.d.ts +5 -2
- package/dist/catalog-fec-params.d.ts.map +1 -1
- package/dist/catalog-fec-params.js +101 -42
- package/dist/catalog-fec-params.js.map +4 -4
- package/dist/catalog-network-source.js +4 -6
- package/dist/catalog-network-source.js.map +4 -4
- package/dist/cmcd-producer.d.ts.map +1 -1
- package/dist/cmcd-producer.js +0 -4
- package/dist/cmcd-producer.js.map +2 -2
- package/dist/delivery-catalog.d.ts +124 -0
- package/dist/delivery-catalog.d.ts.map +1 -0
- package/dist/delivery-catalog.js +1867 -0
- package/dist/delivery-catalog.js.map +7 -0
- package/dist/fec-manager.d.ts +17 -4
- package/dist/fec-manager.d.ts.map +1 -1
- package/dist/fec-manager.js +41 -20
- package/dist/fec-manager.js.map +4 -4
- package/dist/fec-state.d.ts +3 -2
- package/dist/fec-state.d.ts.map +1 -1
- package/dist/fec-state.js +17 -15
- package/dist/fec-state.js.map +4 -4
- package/dist/fec-worker-setup.d.ts +2 -8
- package/dist/fec-worker-setup.d.ts.map +1 -1
- package/dist/fec-worker-setup.js +12 -62
- package/dist/fec-worker-setup.js.map +4 -4
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -0
- package/dist/index.js.map +2 -2
- package/dist/iso-block-locator.js +4 -6
- package/dist/iso-block-locator.js.map +4 -4
- package/dist/mfu-reassembler.js +27 -29
- package/dist/mfu-reassembler.js.map +4 -4
- package/dist/mmtp-container-parser.d.ts +9 -11
- package/dist/mmtp-container-parser.d.ts.map +1 -1
- package/dist/mmtp-container-parser.js +107 -98
- package/dist/mmtp-container-parser.js.map +4 -4
- package/dist/mmtp-container-parser.no-modules.js +133 -108
- package/dist/mmtp-container-parser.no-modules.js.map +4 -4
- package/dist/mmtp-decode-pipeline.js +107 -98
- package/dist/mmtp-decode-pipeline.js.map +4 -4
- package/dist/mmtp-router.d.ts +34 -14
- package/dist/mmtp-router.d.ts.map +1 -1
- package/dist/mmtp-router.js +143 -113
- package/dist/mmtp-router.js.map +4 -4
- package/dist/multicast-input.js +4 -6
- package/dist/multicast-input.js.map +4 -4
- package/dist/multicast-manager.d.ts +39 -3
- package/dist/multicast-manager.d.ts.map +1 -1
- package/dist/multicast-manager.js +264 -156
- package/dist/multicast-manager.js.map +4 -4
- package/dist/multicast-transport.js +14 -14
- package/dist/multicast-transport.js.map +4 -4
- package/dist/multicast-unwrap.js +32 -34
- package/dist/multicast-unwrap.js.map +4 -4
- package/dist/no-modules.js +130 -107
- package/dist/no-modules.js.map +4 -4
- package/dist/repair-fetch.d.ts +86 -2
- package/dist/repair-fetch.d.ts.map +1 -1
- package/dist/repair-fetch.js +86 -17
- package/dist/repair-fetch.js.map +4 -4
- package/dist/repair-layers.js +4 -6
- package/dist/repair-layers.js.map +4 -4
- package/dist/signaling.js +5 -7
- package/dist/signaling.js.map +4 -4
- package/dist/timestamp-codec.js +27 -29
- package/dist/timestamp-codec.js.map +4 -4
- package/dist/wasm-mfu-reassembler.js +4 -6
- package/dist/wasm-mfu-reassembler.js.map +4 -4
- package/dist/wasm-mmtp-container-parser.js +107 -98
- package/dist/wasm-mmtp-container-parser.js.map +4 -4
- package/package.json +5 -6
- package/src/carp-catalog.ts +16 -11
- package/src/catalog-fec-params.ts +38 -17
- package/src/cmcd-producer.ts +0 -6
- package/src/delivery-catalog.ts +498 -0
- package/src/fec-manager.ts +44 -17
- package/src/fec-state.ts +4 -9
- package/src/fec-worker-setup.ts +4 -35
- package/src/index.ts +27 -0
- package/src/mmtp-container-parser.ts +80 -20
- package/src/mmtp-router.ts +71 -29
- package/src/multicast-manager.ts +93 -26
- package/src/repair-fetch.ts +228 -17
- package/test-vectors/catalog/README.md +10 -1
- package/test-vectors/catalog/negative/multicast-endpoint-relay-address.json +39 -0
- package/test-vectors/catalog/negative/raptorq-unaligned-symbol.json +1 -0
- package/test-vectors/catalog/positive/multicast-amt-manual-relay.json +38 -0
- package/test-vectors/catalog/section-codes.json +33 -0
- package/test-vectors/delivery-catalog/README.md +11 -0
- package/test-vectors/delivery-catalog/negative/missing-block-profile.json +58 -0
- package/test-vectors/delivery-catalog/negative/packet-id-signaling.json +59 -0
- package/test-vectors/delivery-catalog/negative/retired-k-padded-block-profile.json +59 -0
- package/test-vectors/delivery-catalog/positive/dash.json +56 -0
- package/test-vectors/delivery-catalog/positive/mmtp-source-only.json +43 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blockcast/mmt-container",
|
|
3
|
-
"version": "0.4.0
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "MMTP/LOC container parsing for MMT over MoQ and SSM",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -178,11 +178,10 @@
|
|
|
178
178
|
},
|
|
179
179
|
"dependencies": {
|
|
180
180
|
"@noble/hashes": "^1.8.0",
|
|
181
|
-
"@blockcast/mmt-fec": "0.
|
|
182
|
-
"@blockcast/mmt-manifest-verify": "0.
|
|
183
|
-
"@blockcast/fec-worker": "0.
|
|
184
|
-
"@blockcast/mmt-
|
|
185
|
-
"@blockcast/mmt-base": "0.3.0-main.d6f2737828fc",
|
|
181
|
+
"@blockcast/mmt-fec": "^0.4.0",
|
|
182
|
+
"@blockcast/mmt-manifest-verify": "^0.4.0",
|
|
183
|
+
"@blockcast/fec-worker": "^0.4.0",
|
|
184
|
+
"@blockcast/mmt-base": "^0.4.0",
|
|
186
185
|
"ajv": "^8.17.1",
|
|
187
186
|
"ajv-formats": "^3.0.1"
|
|
188
187
|
},
|
package/src/carp-catalog.ts
CHANGED
|
@@ -318,17 +318,6 @@ export interface MulticastEndpoint {
|
|
|
318
318
|
* type-narrow with `typeof t === "string"` to handle both.
|
|
319
319
|
*/
|
|
320
320
|
tracks: MulticastTrack[];
|
|
321
|
-
/**
|
|
322
|
-
* AMT relay hostname.
|
|
323
|
-
*
|
|
324
|
-
* @deprecated Superseded by catalog-level `multicast.networkSource`
|
|
325
|
-
* (`{type: "amt", discovery, relay}`). Retained so a catalog published
|
|
326
|
-
* before the migration still parses; emitters MUST NOT write it, and
|
|
327
|
-
* `catalog.schema.json` already rejects it (`additionalProperties: false`
|
|
328
|
-
* on the endpoint), as does moq-rs `MulticastEndpoint`
|
|
329
|
-
* (`deny_unknown_fields`, and it carries no relay field at all).
|
|
330
|
-
*/
|
|
331
|
-
relayAddress?: string;
|
|
332
321
|
/**
|
|
333
322
|
* Aggregate bandwidth of this endpoint in bits per second.
|
|
334
323
|
* RECOMMENDED per draft §4.1 — enables capacity-aware joins.
|
|
@@ -702,6 +691,7 @@ export type CmsfCatalogErrorCode =
|
|
|
702
691
|
| "multicast_auth"
|
|
703
692
|
| "multicast_track"
|
|
704
693
|
| "multicast_packet_id"
|
|
694
|
+
| "multicast_relay_address"
|
|
705
695
|
| "archive_object"
|
|
706
696
|
| "archive_origin";
|
|
707
697
|
|
|
@@ -874,6 +864,11 @@ export function validateCmsfMmtpCatalog(value: unknown): CmsfCatalog {
|
|
|
874
864
|
catalogError("track_fec", `${path}.fec.${field}`, "must be a positive integer");
|
|
875
865
|
}
|
|
876
866
|
}
|
|
867
|
+
// The receiver refuses unaligned RaptorQ geometry (`isFecCatalogGeometry`);
|
|
868
|
+
// the schema's `multipleOf: 8` says the same, so the validator does too.
|
|
869
|
+
if (algorithm === "raptorq" && (config["symbolSize"] as number) % 8 !== 0) {
|
|
870
|
+
catalogError("track_fec", `${path}.fec.symbolSize`, "RaptorQ symbolSize must be a multiple of 8");
|
|
871
|
+
}
|
|
877
872
|
if (typeof config["repairTrack"] !== "string" || config["repairTrack"].length === 0) {
|
|
878
873
|
catalogError("track_fec", `${path}.fec.repairTrack`, "must be a non-empty string");
|
|
879
874
|
}
|
|
@@ -957,6 +952,16 @@ export function validateCmsfMmtpCatalog(value: unknown): CmsfCatalog {
|
|
|
957
952
|
for (let endpointIndex = 0; endpointIndex < endpoints.length; endpointIndex++) {
|
|
958
953
|
const endpoint = endpoints[endpointIndex];
|
|
959
954
|
if (typeof endpoint !== "object" || endpoint === null || Array.isArray(endpoint)) continue;
|
|
955
|
+
// The endpoint relay moved to `multicast.networkSource[{type:"amt",relay}]`.
|
|
956
|
+
// Refuse rather than ignore: a dropped relay strands an AMT endpoint
|
|
957
|
+
// with no tunnel and reads as a gateway failure, not a bad catalog.
|
|
958
|
+
if ("relayAddress" in endpoint) {
|
|
959
|
+
catalogError(
|
|
960
|
+
"multicast_relay_address",
|
|
961
|
+
`$.multicast.endpoints[${endpointIndex}].relayAddress`,
|
|
962
|
+
'relayAddress is retired; publish the relay as multicast.networkSource[{type:"amt",relay}]',
|
|
963
|
+
);
|
|
964
|
+
}
|
|
960
965
|
const refs = (endpoint as Record<string, unknown>)["tracks"];
|
|
961
966
|
if (!Array.isArray(refs)) continue;
|
|
962
967
|
const packetIds = new Map<number, string>();
|
|
@@ -7,9 +7,14 @@
|
|
|
7
7
|
// player-agnostic.
|
|
8
8
|
|
|
9
9
|
import {
|
|
10
|
+
catalogFecAvailable,
|
|
11
|
+
catalogFecDeclaresUnconfigurableInstance,
|
|
10
12
|
FEC_BLOCK_PROFILES,
|
|
11
13
|
isFecBlockProfile,
|
|
14
|
+
locateCatalogFecSource,
|
|
12
15
|
parseFecBlockProfile,
|
|
16
|
+
type CatalogFecRole,
|
|
17
|
+
type CatalogFecSource,
|
|
13
18
|
type FecBlockProfile,
|
|
14
19
|
} from "@blockcast/mmt-base";
|
|
15
20
|
import { catalogFecInterleaveMs, type FecInterleaveCatalog } from "@blockcast/mmt-fec";
|
|
@@ -37,6 +42,15 @@ import type { RepairTarget } from "./repair-fetch.js";
|
|
|
37
42
|
|
|
38
43
|
export { catalogFecInterleaveMs, type FecInterleaveCatalog };
|
|
39
44
|
export { FEC_BLOCK_PROFILES, isFecBlockProfile, parseFecBlockProfile, type FecBlockProfile };
|
|
45
|
+
// The shared catalog FEC source rules (BLO-40851): one copy, in the leaf
|
|
46
|
+
// package transport and every player also read.
|
|
47
|
+
export {
|
|
48
|
+
catalogFecAvailable,
|
|
49
|
+
catalogFecDeclaresUnconfigurableInstance,
|
|
50
|
+
locateCatalogFecSource,
|
|
51
|
+
type CatalogFecRole,
|
|
52
|
+
type CatalogFecSource,
|
|
53
|
+
};
|
|
40
54
|
export {
|
|
41
55
|
assembleRepairLayers,
|
|
42
56
|
assertRepairTrackReachable,
|
|
@@ -416,8 +430,10 @@ export function resolveRepairLayers(
|
|
|
416
430
|
// beside a tracks[] switching-set index (the unified ABR ladder catalog),
|
|
417
431
|
// the rendition blocks are authoritative, exactly as they are for hang's own
|
|
418
432
|
// catalog decode. A typed ref resolves only within its own role.
|
|
433
|
+
// `locateCatalogFecSource` is that precedence rule, shared with transport's
|
|
434
|
+
// endpoint selection and the players' repair inventories.
|
|
419
435
|
const hang = catalog as CatalogWithRenditions;
|
|
420
|
-
const roles:
|
|
436
|
+
const roles: CatalogFecRole[] =
|
|
421
437
|
typeof source === "string"
|
|
422
438
|
? ["video", "audio"]
|
|
423
439
|
: source.type === "audio"
|
|
@@ -425,10 +441,10 @@ export function resolveRepairLayers(
|
|
|
425
441
|
: source.type === "video"
|
|
426
442
|
? ["video"]
|
|
427
443
|
: ["video", "audio"];
|
|
428
|
-
const
|
|
429
|
-
if (
|
|
430
|
-
const renditionPath = `$.${role}.renditions[${JSON.stringify(sourceName)}]`;
|
|
431
|
-
const rendition =
|
|
444
|
+
const located = locateCatalogFecSource(catalog, sourceName, roles);
|
|
445
|
+
if (located?.dialect === "hang") {
|
|
446
|
+
const renditionPath = `$.${located.role}.renditions[${JSON.stringify(sourceName)}]`;
|
|
447
|
+
const rendition = located.entry;
|
|
432
448
|
rejectRepairFieldsOnMediaTrack(renditionPath, rendition, throwRepairContractError);
|
|
433
449
|
const repairRenditions = recordOf(hang.repair?.renditions) ?? {};
|
|
434
450
|
const descriptors: RepairTrackDescriptor[] = Object.entries(repairRenditions).map(([name, entry]) => {
|
|
@@ -473,8 +489,8 @@ export function resolveRepairLayers(
|
|
|
473
489
|
}
|
|
474
490
|
|
|
475
491
|
const msf = msfTracks(catalog);
|
|
476
|
-
|
|
477
|
-
|
|
492
|
+
if (!msf || located?.dialect !== "msf") return undefined;
|
|
493
|
+
const msfIndex = located.index;
|
|
478
494
|
const track = msf.tracks[msfIndex]!;
|
|
479
495
|
const fec = recordOf(track["fec"]);
|
|
480
496
|
const packagingOf = (t: Record<string, unknown>): unknown => t["packaging"];
|
|
@@ -653,19 +669,26 @@ function isoSpanUnavailable(
|
|
|
653
669
|
* `iso-ssbg1-v1` instance, carries no usable block span. Returns undefined for
|
|
654
670
|
* a non-object and for every block whose FEC is available. It reads only the
|
|
655
671
|
* profile and the span: malformed geometry (`sourceSymbols`, `symbolSize`, ...)
|
|
656
|
-
* is the caller's to reject, and takes precedence. Never throws
|
|
672
|
+
* is the caller's to reject, and takes precedence. Never throws on catalog
|
|
673
|
+
* input: whether FEC is available is `catalogFecAvailable` (mmt-base), and a
|
|
674
|
+
* test pins that every unavailable block gets a reason here.
|
|
657
675
|
*
|
|
658
676
|
* @param fec the track's catalog `fec` value.
|
|
659
677
|
* @param fecPath JSON path of that `fec` block; the reason's `path` extends it.
|
|
660
678
|
*/
|
|
661
679
|
export function catalogFecUnavailable(fec: unknown, fecPath: string): TrackFecUnavailable | undefined {
|
|
662
|
-
|
|
663
|
-
|
|
680
|
+
// The decision is mmt-base's `catalogFecAvailable`, which transport reads
|
|
681
|
+
// too; this function only explains a negative one.
|
|
682
|
+
if (catalogFecAvailable(fec)) return undefined;
|
|
683
|
+
const block = recordOf(fec)!;
|
|
664
684
|
const declaresFecInstance = block["algorithm"] !== "none";
|
|
665
|
-
|
|
685
|
+
const reason =
|
|
666
686
|
blockProfileUnavailable(block["blockProfile"], `${fecPath}.blockProfile`, declaresFecInstance) ??
|
|
667
|
-
isoSpanUnavailable(block, `${fecPath}.interleaveDepthMs`, declaresFecInstance)
|
|
668
|
-
)
|
|
687
|
+
isoSpanUnavailable(block, `${fecPath}.interleaveDepthMs`, declaresFecInstance);
|
|
688
|
+
if (reason === undefined) {
|
|
689
|
+
throw new Error(`catalogFecUnavailable: ${fecPath} is unavailable but no reason applies (rule drift)`);
|
|
690
|
+
}
|
|
691
|
+
return reason;
|
|
669
692
|
}
|
|
670
693
|
|
|
671
694
|
/**
|
|
@@ -701,10 +724,8 @@ function fecParams(
|
|
|
701
724
|
// and T are positive integers, the algorithm is not `none`, and the block
|
|
702
725
|
// profile is known.
|
|
703
726
|
if (!catalogDeclaresFec(fec)) {
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
const tValid = Number.isSafeInteger(fec.symbolSize) && (fec.symbolSize ?? 0) > 0;
|
|
707
|
-
if (declaresFecInstance && !(kValid && tValid)) {
|
|
727
|
+
if (catalogFecDeclaresUnconfigurableInstance(fec)) {
|
|
728
|
+
const kValid = Number.isSafeInteger(fec.sourceSymbols) && (fec.sourceSymbols ?? 0) > 0;
|
|
708
729
|
// Any algorithm but `none` declares an FEC instance, so geometry a
|
|
709
730
|
// decoder cannot configure is a malformed catalog, not "no FEC".
|
|
710
731
|
// Returning NO_FEC would silently drop the track's repair
|
package/src/cmcd-producer.ts
CHANGED
|
@@ -97,12 +97,6 @@ function buildFecParams(stats: FecTrackStats): CmcdParams {
|
|
|
97
97
|
params['x-bc-fec-p'] = cfg.repairCount
|
|
98
98
|
params['x-bc-fec-recovery'] = parseFloat((stats.recoveryRate / 100).toFixed(4))
|
|
99
99
|
|
|
100
|
-
// ALTA keys: omit entirely when altaEnabled is false (D-09)
|
|
101
|
-
if (cfg.altaEnabled) {
|
|
102
|
-
params['x-bc-alta-verified'] = stats.altaVerified > 0
|
|
103
|
-
params['x-bc-alta-failures'] = stats.altaFailed
|
|
104
|
-
}
|
|
105
|
-
|
|
106
100
|
return params
|
|
107
101
|
}
|
|
108
102
|
|