@blockcast/mmt-container 2.1.0 → 2.2.0-main.0f6aad7bb803
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/browser-runtime.js +458 -77
- package/dist/browser-runtime.js.map +4 -4
- package/dist/carp-catalog.js.map +1 -1
- package/dist/catalog-fec-params.js.map +1 -1
- package/dist/catalog-network-source.js.map +1 -1
- package/dist/cmcd-producer.d.ts +5 -0
- package/dist/cmcd-producer.d.ts.map +1 -1
- package/dist/cmcd-producer.js.map +2 -2
- package/dist/delivery-catalog.js.map +1 -1
- package/dist/delta-fallback-config.js.map +1 -1
- package/dist/fec-manager.js.map +2 -2
- package/dist/fec-state.js.map +1 -1
- package/dist/fec-worker-setup.js.map +1 -1
- package/dist/held-layer-admission.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +2 -2
- package/dist/iso-block-locator.js.map +1 -1
- package/dist/mfu-reassembler.js +12 -19
- package/dist/mfu-reassembler.js.map +2 -2
- package/dist/mmtp-container-parser.js +12 -19
- package/dist/mmtp-container-parser.js.map +2 -2
- package/dist/mmtp-container-parser.no-modules.js +133 -34
- package/dist/mmtp-container-parser.no-modules.js.map +3 -3
- package/dist/mmtp-decode-pipeline.js +12 -19
- package/dist/mmtp-decode-pipeline.js.map +2 -2
- package/dist/mmtp-fec-session.d.ts +41 -3
- package/dist/mmtp-fec-session.d.ts.map +1 -1
- package/dist/mmtp-fec-session.js +118 -13
- package/dist/mmtp-fec-session.js.map +3 -3
- package/dist/mmtp-router.d.ts +9 -1
- package/dist/mmtp-router.d.ts.map +1 -1
- package/dist/mmtp-router.js +1468 -33
- package/dist/mmtp-router.js.map +4 -4
- package/dist/multicast-auth-catalog.js.map +1 -1
- package/dist/multicast-input.js.map +1 -1
- package/dist/multicast-manager.d.ts +15 -2
- package/dist/multicast-manager.d.ts.map +1 -1
- package/dist/multicast-manager.js +15246 -14969
- package/dist/multicast-manager.js.map +4 -4
- package/dist/multicast-transport.d.ts +11 -3
- package/dist/multicast-transport.d.ts.map +1 -1
- package/dist/multicast-transport.js +255 -19
- package/dist/multicast-transport.js.map +4 -4
- package/dist/multicast-unwrap.js +12 -19
- package/dist/multicast-unwrap.js.map +2 -2
- package/dist/no-modules.js +130 -33
- package/dist/no-modules.js.map +3 -3
- package/dist/repair-fetch.js.map +1 -1
- package/dist/signaling.js.map +2 -2
- package/dist/timestamp-codec.js +12 -19
- package/dist/timestamp-codec.js.map +2 -2
- package/dist/wasm-mfu-reassembler.js.map +1 -1
- package/dist/wasm-mmtp-container-parser.js +12 -19
- package/dist/wasm-mmtp-container-parser.js.map +2 -2
- package/package.json +5 -5
- package/src/cmcd-producer.ts +5 -0
- package/src/index.ts +2 -0
- package/src/mmtp-fec-session.ts +115 -15
- package/src/mmtp-router.ts +81 -16
- package/src/multicast-manager.ts +26 -5
- package/src/multicast-transport.ts +44 -20
|
@@ -6,7 +6,10 @@
|
|
|
6
6
|
|
|
7
7
|
import {
|
|
8
8
|
isMulticastTrackPacketId,
|
|
9
|
+
isUserAgentVerifiedGateway,
|
|
10
|
+
resolveMulticastGateway,
|
|
9
11
|
subscriptionDeliversPacketBatches,
|
|
12
|
+
userAgentVerifiedIngress,
|
|
10
13
|
toWindowMulticastSubscribeConfig,
|
|
11
14
|
type WindowMulticastDelivery,
|
|
12
15
|
type WindowMulticastGateway,
|
|
@@ -52,7 +55,13 @@ export interface MulticastTransportConfig {
|
|
|
52
55
|
protected?: boolean
|
|
53
56
|
}
|
|
54
57
|
|
|
55
|
-
|
|
58
|
+
/**
|
|
59
|
+
* The leg a join resolved to. `'user-agent'`: the browser's own
|
|
60
|
+
* `MulticastReceiver` delivers it, which picks native or AMT itself and does
|
|
61
|
+
* not say which. CMCD has no user-agent value, so a caller reports a
|
|
62
|
+
* `'user-agent'` join as `'native'` (`TransportSnapshot.transport`).
|
|
63
|
+
*/
|
|
64
|
+
export type ResolvedMulticastTransport = 'native' | 'amt' | 'user-agent'
|
|
56
65
|
|
|
57
66
|
/**
|
|
58
67
|
* Why a joined transport handed control back to MoQ.
|
|
@@ -211,16 +220,8 @@ function providerErrorOf(error: unknown): MulticastJoinProviderError | undefined
|
|
|
211
220
|
*/
|
|
212
221
|
const MAX_TRACKED_DROPPED_PIDS = 16
|
|
213
222
|
|
|
214
|
-
type MulticastGlobals = typeof globalThis & {
|
|
215
|
-
multicast?: WindowMulticastGateway
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
function getMulticastGlobals(): MulticastGlobals {
|
|
219
|
-
return globalThis as MulticastGlobals
|
|
220
|
-
}
|
|
221
|
-
|
|
222
223
|
function hasMulticastGateway(): boolean {
|
|
223
|
-
return typeof
|
|
224
|
+
return typeof resolveMulticastGateway()?.subscribe === 'function'
|
|
224
225
|
}
|
|
225
226
|
|
|
226
227
|
/**
|
|
@@ -371,6 +372,9 @@ export class MulticastTransport<TPacketContext = never> {
|
|
|
371
372
|
// listener closure, so an in-place admission change (setContext) applies
|
|
372
373
|
// from the next packet on without rejoining.
|
|
373
374
|
#context: TPacketContext | undefined = undefined
|
|
375
|
+
#deliveredContext: TPacketContext | undefined = undefined
|
|
376
|
+
/** The live join's gateway, when it is the user agent's MulticastReceiver provider. */
|
|
377
|
+
#userAgentGateway: WindowMulticastGateway | undefined = undefined
|
|
374
378
|
// The live join's provider-side filter. An in-place widening must reach it,
|
|
375
379
|
// or the provider never delivers the new ID; null without a live join.
|
|
376
380
|
#providerFilter: ProviderFilter | null = null
|
|
@@ -415,7 +419,7 @@ export class MulticastTransport<TPacketContext = never> {
|
|
|
415
419
|
this.#sender = undefined
|
|
416
420
|
|
|
417
421
|
if (this.#disposed) return this.#declined(generation, 'disposed')
|
|
418
|
-
const gateway = this.#gateway ??
|
|
422
|
+
const gateway = this.#gateway ?? resolveMulticastGateway()
|
|
419
423
|
if (typeof gateway?.subscribe !== 'function') {
|
|
420
424
|
console.warn('[MulticastTransport] Multicast API not available')
|
|
421
425
|
return this.#declined(generation, 'unavailable')
|
|
@@ -435,15 +439,18 @@ export class MulticastTransport<TPacketContext = never> {
|
|
|
435
439
|
console.log(
|
|
436
440
|
`[MulticastTransport] window.multicast.subscribe(${config.sourceAddress ?? config.senderAddress ?? '*'}, ${config.groupAddress}, ${config.port})`,
|
|
437
441
|
)
|
|
442
|
+
// The browser's MulticastReceiver picks native or AMT, and the relay,
|
|
443
|
+
// itself: ask it for the group only.
|
|
444
|
+
const userAgent = isUserAgentVerifiedGateway(gateway)
|
|
438
445
|
const subscribeConfig = toWindowMulticastSubscribeConfig({
|
|
439
446
|
source: config.sourceAddress,
|
|
440
447
|
senderAddress: config.senderAddress,
|
|
441
448
|
group: config.groupAddress,
|
|
442
449
|
port: config.port,
|
|
443
|
-
mode: config.mode,
|
|
444
|
-
amtRelay: config.amtRelay,
|
|
445
|
-
amtRelayPort: config.amtRelayPort,
|
|
446
|
-
amtDiscovery: config.amtDiscovery,
|
|
450
|
+
mode: userAgent ? 'native' : config.mode,
|
|
451
|
+
amtRelay: userAgent ? undefined : config.amtRelay,
|
|
452
|
+
amtRelayPort: userAgent ? undefined : config.amtRelayPort,
|
|
453
|
+
amtDiscovery: userAgent ? undefined : config.amtDiscovery,
|
|
447
454
|
packetIds: config.packetIds,
|
|
448
455
|
tracks: config.tracks,
|
|
449
456
|
atsc3: config.atsc3,
|
|
@@ -506,7 +513,8 @@ export class MulticastTransport<TPacketContext = never> {
|
|
|
506
513
|
acknowledgedUpdate: 0,
|
|
507
514
|
inFlight: 0,
|
|
508
515
|
}
|
|
509
|
-
this.#
|
|
516
|
+
this.#userAgentGateway = userAgent ? gateway : undefined
|
|
517
|
+
this.#setContext(context)
|
|
510
518
|
// Seed the allow-list's counters so accepted packets never insert. An
|
|
511
519
|
// id already counted by an earlier join keeps its count: the counters
|
|
512
520
|
// are cumulative across rejoins, as bytesReceived is.
|
|
@@ -521,7 +529,7 @@ export class MulticastTransport<TPacketContext = never> {
|
|
|
521
529
|
// gateway no longer exposes a mutable transport/transportchange
|
|
522
530
|
// surface, so assign this only after subscribe() has resolved and the
|
|
523
531
|
// returned subscription has passed the event-surface check above.
|
|
524
|
-
this.#resolvedTransport = subscribeConfig.origin === 'amt' ? 'amt' : 'native'
|
|
532
|
+
this.#resolvedTransport = userAgent ? 'user-agent' : subscribeConfig.origin === 'amt' ? 'amt' : 'native'
|
|
525
533
|
// The provider alone knows whether its packets are independent
|
|
526
534
|
// datagrams or an ordered relay of one socket; undeclared promises no
|
|
527
535
|
// ordering. Announce it before the listener can deliver a packet. A
|
|
@@ -630,7 +638,7 @@ export class MulticastTransport<TPacketContext = never> {
|
|
|
630
638
|
// Read per packet: a callback that changes the admission (an in-place
|
|
631
639
|
// rendition switch committing on this very packet) takes effect from the
|
|
632
640
|
// next packet, including the rest of a batch.
|
|
633
|
-
this.#onPacket(packet, this.#
|
|
641
|
+
this.#onPacket(packet, this.#deliveredContext)
|
|
634
642
|
return liveness
|
|
635
643
|
}
|
|
636
644
|
|
|
@@ -872,8 +880,10 @@ export class MulticastTransport<TPacketContext = never> {
|
|
|
872
880
|
}
|
|
873
881
|
|
|
874
882
|
/**
|
|
875
|
-
*
|
|
876
|
-
*
|
|
883
|
+
* The live join's context as the caller gave it (the join's `context`, or
|
|
884
|
+
* the last setContext), or undefined without a live join. On a native
|
|
885
|
+
* provider each accepted packet is delivered with a marked copy of it
|
|
886
|
+
* (`userAgentVerifiedIngress`); this getter never carries the mark.
|
|
877
887
|
*/
|
|
878
888
|
get context(): TPacketContext | undefined {
|
|
879
889
|
return this.#context
|
|
@@ -899,7 +909,19 @@ export class MulticastTransport<TPacketContext = never> {
|
|
|
899
909
|
'[MulticastTransport] setContext needs a live join; join() carries the first context',
|
|
900
910
|
)
|
|
901
911
|
}
|
|
912
|
+
this.#setContext(context)
|
|
913
|
+
}
|
|
914
|
+
|
|
915
|
+
/**
|
|
916
|
+
* The join's context, and what the subscription delivers with each packet:
|
|
917
|
+
* marked admitted by the user agent when the gateway is its native
|
|
918
|
+
* MulticastReceiver provider. feedPacket never marks.
|
|
919
|
+
*/
|
|
920
|
+
#setContext(context: TPacketContext | undefined): void {
|
|
902
921
|
this.#context = context
|
|
922
|
+
this.#deliveredContext = this.#userAgentGateway !== undefined && typeof context === 'object' && context !== null
|
|
923
|
+
? userAgentVerifiedIngress(context, this.#userAgentGateway)
|
|
924
|
+
: context
|
|
903
925
|
}
|
|
904
926
|
|
|
905
927
|
/**
|
|
@@ -1040,6 +1062,8 @@ export class MulticastTransport<TPacketContext = never> {
|
|
|
1040
1062
|
this.#matchedSource = undefined
|
|
1041
1063
|
this.#providerFilter = null
|
|
1042
1064
|
this.#context = undefined
|
|
1065
|
+
this.#deliveredContext = undefined
|
|
1066
|
+
this.#userAgentGateway = undefined
|
|
1043
1067
|
this.#withdrawnPacketIds.clear()
|
|
1044
1068
|
}
|
|
1045
1069
|
|