@blockcast/mmt-container 2.2.0-main.efb4fa4521af → 2.2.0-main.f480a7ede8b1
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 +29 -17
- package/dist/browser-runtime.js +446 -162
- package/dist/browser-runtime.js.map +3 -3
- package/dist/catalog-fec-params.d.ts +17 -1
- package/dist/catalog-fec-params.d.ts.map +1 -1
- package/dist/catalog-fec-params.js +15 -0
- package/dist/catalog-fec-params.js.map +2 -2
- package/dist/cmcd-producer.d.ts +60 -47
- package/dist/cmcd-producer.d.ts.map +1 -1
- package/dist/cmcd-producer.js +138 -109
- package/dist/cmcd-producer.js.map +2 -2
- package/dist/delivery-catalog.js +26 -16
- package/dist/delivery-catalog.js.map +2 -2
- package/dist/delta-fallback-config.js.map +1 -1
- package/dist/fec-manager.d.ts +3 -1
- package/dist/fec-manager.d.ts.map +1 -1
- package/dist/fec-manager.js +121 -5
- package/dist/fec-manager.js.map +2 -2
- package/dist/fec-worker-setup.d.ts +1 -1
- package/dist/fec-worker-setup.js +1 -1
- package/dist/fec-worker-setup.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -1
- package/dist/index.js.map +2 -2
- package/dist/iso-block-locator.d.ts +9 -0
- package/dist/iso-block-locator.d.ts.map +1 -1
- package/dist/iso-block-locator.js +17 -0
- package/dist/iso-block-locator.js.map +2 -2
- package/dist/iso-bmff-timing.d.ts +10 -1
- package/dist/iso-bmff-timing.d.ts.map +1 -1
- package/dist/iso-bmff-timing.js +36 -2
- package/dist/iso-bmff-timing.js.map +2 -2
- package/dist/media-router.js.map +1 -1
- package/dist/mmtp-container-parser.d.ts +37 -2
- package/dist/mmtp-container-parser.d.ts.map +1 -1
- package/dist/mmtp-container-parser.js +86 -9
- package/dist/mmtp-container-parser.js.map +2 -2
- package/dist/mmtp-container-parser.no-modules.js +89 -11
- package/dist/mmtp-container-parser.no-modules.js.map +2 -2
- package/dist/mmtp-decode-pipeline.js +85 -9
- package/dist/mmtp-decode-pipeline.js.map +2 -2
- package/dist/mmtp-router.d.ts +6 -0
- package/dist/mmtp-router.d.ts.map +1 -1
- package/dist/mmtp-router.js +148 -27
- package/dist/mmtp-router.js.map +2 -2
- package/dist/multicast-manager.js +269 -32
- package/dist/multicast-manager.js.map +2 -2
- package/dist/multicast-transport.js +26 -16
- package/dist/multicast-transport.js.map +2 -2
- package/dist/no-modules.js +85 -9
- package/dist/no-modules.js.map +2 -2
- package/dist/repair-layer-subscriptions.d.ts +6 -2
- package/dist/repair-layer-subscriptions.d.ts.map +1 -1
- package/dist/repair-layer-subscriptions.js +6 -3
- package/dist/repair-layer-subscriptions.js.map +2 -2
- package/dist/track-session.d.ts +1 -1
- package/dist/track-session.js.map +1 -1
- package/dist/wasm-mmtp-container-parser.js +85 -9
- package/dist/wasm-mmtp-container-parser.js.map +2 -2
- package/package.json +8 -5
- package/src/catalog-fec-params.ts +36 -1
- package/src/cmcd-producer.ts +189 -179
- package/src/fec-manager.ts +130 -5
- package/src/fec-worker-setup.ts +2 -2
- package/src/index.ts +7 -2
- package/src/iso-block-locator.ts +19 -0
- package/src/iso-bmff-timing.ts +40 -1
- package/src/mmtp-container-parser.ts +96 -8
- package/src/mmtp-router.ts +68 -1
- package/src/repair-layer-subscriptions.ts +13 -5
- package/src/track-session.ts +1 -1
package/src/mmtp-router.ts
CHANGED
|
@@ -48,10 +48,12 @@ import {
|
|
|
48
48
|
} from "./cmaf-block-assembler.js";
|
|
49
49
|
import {
|
|
50
50
|
MmtpContainerParser,
|
|
51
|
+
authoredAdjacent,
|
|
51
52
|
isMfuKeyframeMetadata,
|
|
52
53
|
type FecReleaseGate,
|
|
53
54
|
type FrameMeta as ParserFrameMeta,
|
|
54
55
|
type ParsedMmtpPacket,
|
|
56
|
+
type MmtpRecoveredHeadTimingStats,
|
|
55
57
|
} from "./mmtp-container-parser.js";
|
|
56
58
|
import { type TrackRole } from "./carp-catalog.js";
|
|
57
59
|
import {
|
|
@@ -511,6 +513,9 @@ export type RoutedPacketMeta = {
|
|
|
511
513
|
mmtpTimestamp: bigint;
|
|
512
514
|
/**
|
|
513
515
|
* The MMTP header RAP flag: the packet starts a random access point. On a
|
|
516
|
+
* track under a keyframe overlay it is also set on the FT=0 and FT=1 data
|
|
517
|
+
* units that govern a covered keyframe (draft-ramadan-moq-mmt-02 7.4.2), so
|
|
518
|
+
* it can precede the keyframe's first MFU fragment. On a
|
|
514
519
|
* `recovered` packet it is read from the FEC-reconstructed header, which is
|
|
515
520
|
* byte-exact outside packet_sequence_number, so it is the flag the
|
|
516
521
|
* publisher sent. The router's own gap decisions deliberately ignore it for
|
|
@@ -1400,7 +1405,7 @@ export class MmtpRouter {
|
|
|
1400
1405
|
const cb = this.#getFrameCallback(packetId);
|
|
1401
1406
|
if (isVideo && !assembler) {
|
|
1402
1407
|
if (frameMeta.recovered) {
|
|
1403
|
-
this.#routeDirectRecoveredVideo(packetId, data, frameMeta, cb);
|
|
1408
|
+
this.#routeDirectRecoveredVideo(packetId, data, frameMeta, cb, meta.fecSbn);
|
|
1404
1409
|
} else {
|
|
1405
1410
|
this.#routeDirectSourceVideo(packetId, data, frameMeta, cb);
|
|
1406
1411
|
}
|
|
@@ -1915,6 +1920,11 @@ export class MmtpRouter {
|
|
|
1915
1920
|
return { ...this.#overlayStats };
|
|
1916
1921
|
}
|
|
1917
1922
|
|
|
1923
|
+
/** Recovered FT=2 heads held for their FT=1, and how each left the wait (BLO-53369). */
|
|
1924
|
+
get recoveredHeadsAwaitingTiming(): Readonly<MmtpRecoveredHeadTimingStats> {
|
|
1925
|
+
return this.#parser.recoveredHeadsAwaitingTiming;
|
|
1926
|
+
}
|
|
1927
|
+
|
|
1918
1928
|
#isOverlayRepair(repairPacketId: number, repairTrackName?: string): boolean {
|
|
1919
1929
|
return this.#overlayLegs.has(repairPacketId) ||
|
|
1920
1930
|
(repairTrackName !== undefined && this.#overlayRepairNames.has(repairTrackName));
|
|
@@ -4817,8 +4827,28 @@ export class MmtpRouter {
|
|
|
4817
4827
|
data: Uint8Array,
|
|
4818
4828
|
meta: RoutedFrameMeta,
|
|
4819
4829
|
cb: FrameCallback | null,
|
|
4830
|
+
/** The base SS_ID the FEC release gate ordered the frame by, if any. */
|
|
4831
|
+
fecSbn: number | undefined,
|
|
4820
4832
|
): void {
|
|
4821
4833
|
const streamKey = this.#mediaStreamKey(packetId, meta.catalogTrackName);
|
|
4834
|
+
// The FEC release gate let this frame out in order: only once every
|
|
4835
|
+
// block between it and the frame before it resolved, or because it
|
|
4836
|
+
// starts where that frame ended. Nothing still in flight can precede it
|
|
4837
|
+
// then, so it plays now, as a source frame does; holding it for the next
|
|
4838
|
+
// intact frame cost every repaired burst its length in decoder input
|
|
4839
|
+
// (BLO-52085). An overlay recovery names no base block for the gate to
|
|
4840
|
+
// wait on, so past a gap it may be ahead of frames still in flight (an
|
|
4841
|
+
// overlay that outran the wire, BLO-53342): it keeps waiting for the
|
|
4842
|
+
// source cursor below, unless it starts where the last emitted frame
|
|
4843
|
+
// ended (on this direct path, the delivered high water).
|
|
4844
|
+
if (this.#isFecTrack(packetId)) {
|
|
4845
|
+
const high = this.#deliveredVideoHighWaterByStream.get(streamKey);
|
|
4846
|
+
if (fecSbn !== undefined || (high !== undefined && authoredAdjacent(high, meta))) {
|
|
4847
|
+
this.#drainDirectRecoveredVideo(streamKey, packetId, frame => frame.timestamp <= meta.timestamp, cb);
|
|
4848
|
+
this.#emitDirectVideo(packetId, data, meta, cb);
|
|
4849
|
+
return;
|
|
4850
|
+
}
|
|
4851
|
+
}
|
|
4822
4852
|
this.#enqueueDirectRecoveredVideo(packetId, data, meta);
|
|
4823
4853
|
const lastSourceTs = this.#lastDirectSourceVideoTsByStream.get(streamKey);
|
|
4824
4854
|
this.#drainDirectRecoveredVideo(
|
|
@@ -5206,6 +5236,43 @@ export class MmtpRouter {
|
|
|
5206
5236
|
);
|
|
5207
5237
|
}
|
|
5208
5238
|
|
|
5239
|
+
// A recovered head whose sample FT=1 has not named yet (an overlay that
|
|
5240
|
+
// outran the source path) would complete its data unit untimed: the unit
|
|
5241
|
+
// is dropped, marked completed, and the timed source copy is then refused
|
|
5242
|
+
// (BLO-53342). Hand it to the parser instead, which holds it in its
|
|
5243
|
+
// awaiting-timing queue and feeds it again when FT=1 lands; its recovered
|
|
5244
|
+
// continuations park in the reassembler meanwhile. If the source path
|
|
5245
|
+
// lost the head, this held copy is the keyframe (BLO-53369).
|
|
5246
|
+
const untimedHead = (sym: (typeof result.symbols)[number]): boolean =>
|
|
5247
|
+
sym.fragmentType === 2 &&
|
|
5248
|
+
sym.fragment.fragmentationIndicator === 1 &&
|
|
5249
|
+
sym.fragment.movieFragmentSequenceNumber !== undefined &&
|
|
5250
|
+
sym.fragment.sampleNumber !== undefined &&
|
|
5251
|
+
!this.#parser.hasAuthoredTimingFor(
|
|
5252
|
+
ownerPacketId,
|
|
5253
|
+
sym.fragment.mpuSequenceNumber,
|
|
5254
|
+
sym.fragment.movieFragmentSequenceNumber,
|
|
5255
|
+
sym.fragment.sampleNumber,
|
|
5256
|
+
catalogTrackName,
|
|
5257
|
+
);
|
|
5258
|
+
for (const sym of result.symbols) {
|
|
5259
|
+
if (!untimedHead(sym) ||
|
|
5260
|
+
this.#sourceSeqReceived(ownerPacketId, sym.packetSequenceNumber, catalogTrackName)) continue;
|
|
5261
|
+
this.#feedViaParser(
|
|
5262
|
+
sym.rawSymbol,
|
|
5263
|
+
{ packetId: ownerPacketId, sequenceNumber: sym.packetSequenceNumber },
|
|
5264
|
+
undefined,
|
|
5265
|
+
{
|
|
5266
|
+
skipFecPayloadId: true,
|
|
5267
|
+
recovered: true,
|
|
5268
|
+
deliveryProvenance,
|
|
5269
|
+
...fecSbnOf(sym.index),
|
|
5270
|
+
...(catalogTrackName === undefined ? {} : { catalogTrackName }),
|
|
5271
|
+
},
|
|
5272
|
+
);
|
|
5273
|
+
}
|
|
5274
|
+
result = { ...result, symbols: result.symbols.filter((sym) => !untimedHead(sym)) };
|
|
5275
|
+
|
|
5209
5276
|
// MSE assembler path: route recovered block as pre-assembled frames (skip FT=0)
|
|
5210
5277
|
// BLO-3035 layer 3: recovered symbols are RAW MFU fragments, not complete
|
|
5211
5278
|
// frames. A keyframe can span multiple packets (FI=1/2/3); pushing each
|
|
@@ -15,7 +15,10 @@
|
|
|
15
15
|
* base (`MmtpRouter.feedRepairPacket(..., repairTrackName)`).
|
|
16
16
|
*
|
|
17
17
|
* `stream` delivery means QUIC retransmits: no repair track is ever
|
|
18
|
-
* subscribed (FEC only for unreliable transports).
|
|
18
|
+
* subscribed (FEC only for unreliable transports). The mode is the source's
|
|
19
|
+
* `deliveryMode` (`catalogTrackDeliveryMode`); absent is `datagram`. It is
|
|
20
|
+
* read from the current source, so on a catalog refresh re-feed the updated
|
|
21
|
+
* source through `switchSource` for a changed `deliveryMode` to take effect.
|
|
19
22
|
*
|
|
20
23
|
* ABR switch R -> R' (`switchSource`): R's subscriptions are closed, the layer
|
|
21
24
|
* count carries to R', and any packet R's subscriptions deliver after the
|
|
@@ -35,6 +38,8 @@ export interface RepairLayerSource {
|
|
|
35
38
|
repairLayers?: readonly RepairLayerParams[]
|
|
36
39
|
/** Keyframe overlays (`TrackFecParams.repairOverlays`); at most one is used. */
|
|
37
40
|
repairOverlays?: readonly RepairOverlayParams[]
|
|
41
|
+
/** The publisher's MoQ delivery mode; absent is `datagram`. */
|
|
42
|
+
deliveryMode?: MoqRepairDelivery
|
|
38
43
|
}
|
|
39
44
|
|
|
40
45
|
export interface RepairTrackSubscription {
|
|
@@ -43,7 +48,6 @@ export interface RepairTrackSubscription {
|
|
|
43
48
|
|
|
44
49
|
export interface RepairLayerSubscriptionsOptions {
|
|
45
50
|
source: RepairLayerSource
|
|
46
|
-
delivery: MoqRepairDelivery
|
|
47
51
|
/** Subscribe one repair track; every object payload goes to `onPacket`. */
|
|
48
52
|
subscribe(
|
|
49
53
|
repairTrackName: string,
|
|
@@ -110,7 +114,7 @@ export class RepairLayerSubscriptions {
|
|
|
110
114
|
* or interleaved sequences read as loss.
|
|
111
115
|
*/
|
|
112
116
|
noteSourceSequence(seq: number): void {
|
|
113
|
-
if (this.#disposed || this.#
|
|
117
|
+
if (this.#disposed || this.#delivery() === 'stream') return
|
|
114
118
|
seq >>>= 0
|
|
115
119
|
if (this.#lastSeq === undefined) {
|
|
116
120
|
this.#lastSeq = seq
|
|
@@ -152,13 +156,13 @@ export class RepairLayerSubscriptions {
|
|
|
152
156
|
this.#expected = 0
|
|
153
157
|
this.#lost = 0
|
|
154
158
|
this.#wantFewer = 0
|
|
155
|
-
this.#layerCount = Math.min(this.#layerCount, this.#layers().length)
|
|
159
|
+
this.#layerCount = this.#delivery() === 'stream' ? 0 : Math.min(this.#layerCount, this.#layers().length)
|
|
156
160
|
this.#reconcile()
|
|
157
161
|
}
|
|
158
162
|
|
|
159
163
|
snapshot(): RepairLayerSubscriptionsSnapshot {
|
|
160
164
|
return {
|
|
161
|
-
delivery: this.#
|
|
165
|
+
delivery: this.#delivery(),
|
|
162
166
|
layerCount: this.#layerCount,
|
|
163
167
|
subscribedTracks: [...this.#subs.keys()],
|
|
164
168
|
repairPackets: this.#repairPackets,
|
|
@@ -174,6 +178,10 @@ export class RepairLayerSubscriptions {
|
|
|
174
178
|
this.#disposed = true
|
|
175
179
|
}
|
|
176
180
|
|
|
181
|
+
#delivery(): MoqRepairDelivery {
|
|
182
|
+
return this.#source.deliveryMode === 'stream' ? 'stream' : 'datagram'
|
|
183
|
+
}
|
|
184
|
+
|
|
177
185
|
#layers(): readonly RepairLayerParams[] {
|
|
178
186
|
return this.#source.repairLayers ?? []
|
|
179
187
|
}
|
package/src/track-session.ts
CHANGED
|
@@ -58,7 +58,7 @@ export interface TrackSessionConfig {
|
|
|
58
58
|
* This is runtime join state, not catalog geometry: a receiver on a clean
|
|
59
59
|
* path joins layer 0 only while a lossy one adds layers, so the catalog's
|
|
60
60
|
* total P is not what this receiver is receiving. Diagnostics that report P
|
|
61
|
-
* (the worker snapshot, CMCD `
|
|
61
|
+
* (the worker snapshot, CMCD `com.blockcast-fp`) must read this.
|
|
62
62
|
*
|
|
63
63
|
* Absent when the caller joins no layers explicitly, in which case P_0 is
|
|
64
64
|
* what was joined. That is an identity on a single-layer track, not a
|