@blockcast/mmt-base 2.2.0-main.51d1358fdf4c → 2.2.0-main.5da4e39e7fb8
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/dist/datagram-leg-size.d.ts +30 -0
- package/dist/datagram-leg-size.d.ts.map +1 -0
- package/dist/datagram-leg-size.js +42 -0
- package/dist/datagram-leg-size.js.map +1 -0
- package/dist/fec-bindings.d.ts +13 -1
- package/dist/fec-bindings.d.ts.map +1 -1
- package/dist/fec-bindings.js +29 -6
- package/dist/fec-bindings.js.map +1 -1
- package/dist/fec-catalog.d.ts +4 -1
- package/dist/fec-catalog.d.ts.map +1 -1
- package/dist/fec-catalog.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/mmtp-siblings.d.ts +50 -0
- package/dist/mmtp-siblings.d.ts.map +1 -0
- package/dist/mmtp-siblings.js +142 -0
- package/dist/mmtp-siblings.js.map +1 -0
- package/dist/mmtp.d.ts +0 -13
- package/dist/mmtp.d.ts.map +1 -1
- package/dist/mmtp.js +13 -21
- package/dist/mmtp.js.map +1 -1
- package/dist/multicast-catalog.d.ts.map +1 -1
- package/dist/multicast-catalog.js +11 -2
- package/dist/multicast-catalog.js.map +1 -1
- package/package.json +1 -1
- package/src/datagram-leg-size.ts +46 -0
- package/src/fec-bindings.ts +43 -7
- package/src/fec-catalog.ts +4 -1
- package/src/index.ts +2 -0
- package/src/mmtp-siblings.ts +161 -0
- package/src/mmtp.ts +15 -37
- package/src/multicast-catalog.ts +10 -1
package/src/mmtp.ts
CHANGED
|
@@ -374,7 +374,6 @@ function isEmptyOrExactLegacyTrailer(payload: Uint8Array, start: number, end: nu
|
|
|
374
374
|
|
|
375
375
|
interface DeclaredTrailerLayout {
|
|
376
376
|
hasFecId: boolean
|
|
377
|
-
hasOverlayFecId: boolean
|
|
378
377
|
}
|
|
379
378
|
|
|
380
379
|
/** Options for extractMFUPayload and explainMFURejection. */
|
|
@@ -385,15 +384,6 @@ export interface MFUExtractOptions {
|
|
|
385
384
|
* was already stripped before WASM decoding.
|
|
386
385
|
*/
|
|
387
386
|
skipFecId?: boolean
|
|
388
|
-
/**
|
|
389
|
-
* The catalog declares a keyframe overlay (`scope: "keyframe"` repair track)
|
|
390
|
-
* for this packet's source. A RAP packet then carries two Source FEC Payload
|
|
391
|
-
* IDs, base first and overlay last (BLO-32719 Clarification 7). This is a
|
|
392
|
-
* catalog fact, never inferred: the header has no overlay bit, and a payload
|
|
393
|
-
* four bytes shorter is byte-identical to a missing overlay. Mirrors
|
|
394
|
-
* mmt-core `split_payload_and_source_fec_trailers(overlay_declared)`.
|
|
395
|
-
*/
|
|
396
|
-
overlayDeclared?: boolean
|
|
397
387
|
}
|
|
398
388
|
|
|
399
389
|
function resolveDeclaredTrailers(
|
|
@@ -401,38 +391,31 @@ function resolveDeclaredTrailers(
|
|
|
401
391
|
declaredEnd: number,
|
|
402
392
|
fecType: number,
|
|
403
393
|
options?: MFUExtractOptions,
|
|
404
|
-
rapFlag = false,
|
|
405
394
|
): DeclaredTrailerLayout | null {
|
|
406
395
|
if (declaredEnd > payload.length) return null
|
|
407
396
|
|
|
408
397
|
if (options?.skipFecId) {
|
|
409
398
|
return isEmptyOrExactLegacyTrailer(payload, declaredEnd, payload.length)
|
|
410
|
-
? { hasFecId: false
|
|
399
|
+
? { hasFecId: false }
|
|
411
400
|
: null
|
|
412
401
|
}
|
|
413
402
|
|
|
414
|
-
const overlay = options?.overlayDeclared === true && rapFlag
|
|
415
403
|
if (fecType === 1) {
|
|
416
|
-
const fecStart = payload.length -
|
|
404
|
+
const fecStart = payload.length - SOURCE_FEC_PAYLOAD_ID_SIZE
|
|
417
405
|
if (fecStart < declaredEnd || !isEmptyOrExactLegacyTrailer(payload, declaredEnd, fecStart)) {
|
|
418
406
|
return null
|
|
419
407
|
}
|
|
420
|
-
return { hasFecId: true
|
|
408
|
+
return { hasFecId: true }
|
|
421
409
|
}
|
|
422
|
-
|
|
423
|
-
if (fecType !== 0 || overlay) return null
|
|
410
|
+
if (fecType !== 0) return null
|
|
424
411
|
|
|
425
412
|
if (isEmptyOrExactLegacyTrailer(payload, declaredEnd, payload.length)) {
|
|
426
|
-
return { hasFecId: false
|
|
413
|
+
return { hasFecId: false }
|
|
427
414
|
}
|
|
428
415
|
|
|
429
416
|
return null
|
|
430
417
|
}
|
|
431
418
|
|
|
432
|
-
function sourceFecTrailerSize(overlay: boolean): number {
|
|
433
|
-
return overlay ? 2 * SOURCE_FEC_PAYLOAD_ID_SIZE : SOURCE_FEC_PAYLOAD_ID_SIZE
|
|
434
|
-
}
|
|
435
|
-
|
|
436
419
|
/**
|
|
437
420
|
* Extract NAL unit payload from MMTP packet
|
|
438
421
|
*/
|
|
@@ -458,8 +441,6 @@ export interface MFUExtraction {
|
|
|
458
441
|
itemId: number | null
|
|
459
442
|
/** Source FEC Payload ID if present (`FEC_type == 1`), or null */
|
|
460
443
|
fecPayloadId: { ssId: number } | null
|
|
461
|
-
/** Keyframe-overlay Source FEC Payload ID: RAP packets with `overlayDeclared` only. */
|
|
462
|
-
overlayFecPayloadId: { ssId: number } | null
|
|
463
444
|
}
|
|
464
445
|
|
|
465
446
|
/**
|
|
@@ -481,8 +462,6 @@ export interface MFUExtraction {
|
|
|
481
462
|
* FEC-recovered symbols where the FEC PID was already stripped before WASM decoding
|
|
482
463
|
* but the fecType bits in byte 0 still reflect the original packet (FEC Type=1 per
|
|
483
464
|
* draft-ramadan-moq-mmt-01 §3.1).
|
|
484
|
-
* @param options.overlayDeclared The catalog declares a keyframe overlay for this
|
|
485
|
-
* source, so a RAP packet carries an 8-byte trailer (see MFUExtractOptions).
|
|
486
465
|
* @returns Extracted MFU data + metadata, or null if packet is too small
|
|
487
466
|
*/
|
|
488
467
|
interface MfuPlan {
|
|
@@ -568,7 +547,6 @@ function planMfuExtraction(
|
|
|
568
547
|
layout.dataEnd,
|
|
569
548
|
header.fecType,
|
|
570
549
|
options,
|
|
571
|
-
header.rapFlag,
|
|
572
550
|
)
|
|
573
551
|
if (!trailerLayout) {
|
|
574
552
|
// The most common cause is a producer whose Source FEC Payload ID width
|
|
@@ -576,7 +554,7 @@ function planMfuExtraction(
|
|
|
576
554
|
// leaving operators to infer it from a generic trailer error.
|
|
577
555
|
if (!options?.skipFecId && header.fecType === 1) {
|
|
578
556
|
const observed = payload.length - layout.dataEnd
|
|
579
|
-
const expected =
|
|
557
|
+
const expected = SOURCE_FEC_PAYLOAD_ID_SIZE
|
|
580
558
|
if (observed !== expected) {
|
|
581
559
|
return {
|
|
582
560
|
rejection: {
|
|
@@ -664,17 +642,17 @@ function extractPlannedMfu(
|
|
|
664
642
|
|
|
665
643
|
const data = payload.subarray(mfuOffset, dataEnd)
|
|
666
644
|
|
|
667
|
-
const
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
645
|
+
const fecPayloadId = trailerLayout.hasFecId
|
|
646
|
+
? {
|
|
647
|
+
ssId: new DataView(
|
|
648
|
+
mmtpPacket.buffer,
|
|
649
|
+
mmtpPacket.byteOffset + mmtpPacket.length - SOURCE_FEC_PAYLOAD_ID_SIZE,
|
|
650
|
+
4,
|
|
651
|
+
).getUint32(0, false),
|
|
652
|
+
}
|
|
675
653
|
: null
|
|
676
654
|
|
|
677
|
-
return { header, mpu, fragmentType, data, mfuDuHeader, itemId, fecPayloadId
|
|
655
|
+
return { header, mpu, fragmentType, data, mfuDuHeader, itemId, fecPayloadId }
|
|
678
656
|
}
|
|
679
657
|
|
|
680
658
|
/**
|
package/src/multicast-catalog.ts
CHANGED
|
@@ -255,8 +255,11 @@ export function multicastCatalogIssues(
|
|
|
255
255
|
|
|
256
256
|
const tracks = Array.isArray(catalog["tracks"]) ? catalog["tracks"] : [];
|
|
257
257
|
const namespaceOf = new Map<string, unknown>();
|
|
258
|
+
const modeOf = new Map<string, unknown>();
|
|
258
259
|
for (const track of tracks) {
|
|
259
|
-
if (isObject(track)
|
|
260
|
+
if (!isObject(track) || typeof track["name"] !== "string") continue;
|
|
261
|
+
namespaceOf.set(track["name"], track["namespace"]);
|
|
262
|
+
modeOf.set(track["name"], track["mmtpMode"]);
|
|
260
263
|
}
|
|
261
264
|
const tagged = (catalog as { [CATALOG_NAMESPACE]?: unknown })[CATALOG_NAMESPACE];
|
|
262
265
|
let referenceNamespace = options.catalogNamespace ?? (typeof tagged === "string" ? tagged : undefined);
|
|
@@ -337,6 +340,12 @@ export function multicastCatalogIssues(
|
|
|
337
340
|
const ref = refs[refIndex];
|
|
338
341
|
const name = isObject(ref) ? ref["name"] : ref;
|
|
339
342
|
if (typeof name !== "string") continue;
|
|
343
|
+
// mmt-02 4.3.1: the "mfu" and "mfu-datagram" tracks carry the same
|
|
344
|
+
// MMTP sub-flow, so an endpoint lists the "mfu" track and never the
|
|
345
|
+
// datagram one; a receiver ignores an endpoint that does.
|
|
346
|
+
if (modeOf.get(name) === "mfu-datagram") {
|
|
347
|
+
fail("multicast_track", `${at}.tracks[${refIndex}].name`, `track ${JSON.stringify(name)} is an "mfu-datagram" track, which rides no multicast endpoint; list its "mfu" sibling (draft-ramadan-moq-mmt-02 4.3.1)`);
|
|
348
|
+
}
|
|
340
349
|
const namespace = namespaceOf.get(name);
|
|
341
350
|
if (typeof namespace !== "string") continue;
|
|
342
351
|
referenceNamespace ??= namespace;
|