@blockcast/mmt-container 0.1.0-main.1fa0d55ca4da → 0.1.0-main.316a83f537cf
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 +48 -143
- package/dist/browser-runtime.js.map +2 -2
- package/dist/fec-manager.js.map +2 -2
- package/dist/fec-worker-setup.js.map +2 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -2
- package/dist/index.js.map +2 -2
- package/dist/media-router.js.map +2 -2
- package/dist/mfu-reassembler.d.ts +24 -30
- package/dist/mfu-reassembler.d.ts.map +1 -1
- package/dist/mfu-reassembler.js +3 -16
- package/dist/mfu-reassembler.js.map +2 -2
- package/dist/mmtp-container-parser.js +3 -16
- package/dist/mmtp-container-parser.js.map +2 -2
- package/dist/mmtp-container-parser.no-modules.js +3 -16
- package/dist/mmtp-container-parser.no-modules.js.map +2 -2
- package/dist/mmtp-decode-pipeline.js +3 -16
- package/dist/mmtp-decode-pipeline.js.map +2 -2
- package/dist/mmtp-router.js +3 -16
- package/dist/mmtp-router.js.map +2 -2
- package/dist/multicast-manager.js +3 -16
- package/dist/multicast-manager.js.map +2 -2
- package/dist/no-modules.js +3 -16
- package/dist/no-modules.js.map +2 -2
- package/dist/track-session.d.ts +13 -57
- package/dist/track-session.d.ts.map +1 -1
- package/dist/track-session.js +45 -127
- package/dist/track-session.js.map +2 -2
- package/dist/wasm-mfu-reassembler.js.map +2 -2
- package/dist/wasm-mmtp-container-parser.js +3 -16
- package/dist/wasm-mmtp-container-parser.js.map +2 -2
- package/package.json +6 -6
- package/src/index.ts +0 -1
- package/src/mfu-reassembler.ts +30 -61
- package/src/track-session.ts +57 -178
package/dist/browser-runtime.js
CHANGED
|
@@ -1101,7 +1101,7 @@ var MFUReassembler = class {
|
|
|
1101
1101
|
for (const [address, pending] of __privateGet(this, _pendingContinuations)) {
|
|
1102
1102
|
if (pending.timeoutId !== void 0) clearTimeout(pending.timeoutId);
|
|
1103
1103
|
delete pending.timeoutId;
|
|
1104
|
-
if (ms !== null &&
|
|
1104
|
+
if (ms !== null && __privateMethod(this, _MFUReassembler_instances, openRunAt_fn).call(this, address) === void 0) {
|
|
1105
1105
|
pending.timeoutId = setTimeout(() => __privateMethod(this, _MFUReassembler_instances, onPendingTimeout_fn).call(this, address), Math.max(0, pending.startedAt + ms - now));
|
|
1106
1106
|
}
|
|
1107
1107
|
}
|
|
@@ -1354,7 +1354,6 @@ parkContinuation_fn = function(address, fragment) {
|
|
|
1354
1354
|
__privateMethod(this, _MFUReassembler_instances, reject_fn).call(this, "active-data-unit-limit", "active MFU data-unit limit reached");
|
|
1355
1355
|
}
|
|
1356
1356
|
}
|
|
1357
|
-
let reAnchored = false;
|
|
1358
1357
|
if (pending === void 0) {
|
|
1359
1358
|
pending = {
|
|
1360
1359
|
fragments: /* @__PURE__ */ new Map(),
|
|
@@ -1369,13 +1368,12 @@ parkContinuation_fn = function(address, fragment) {
|
|
|
1369
1368
|
pending.admissionSeq = __privateWrapper(this, _nextAdmissionSeq)._++;
|
|
1370
1369
|
pending.startedAt = Date.now();
|
|
1371
1370
|
__privateMethod(this, _MFUReassembler_instances, clearPendingTimeout_fn).call(this, address);
|
|
1372
|
-
|
|
1371
|
+
__privateMethod(this, _MFUReassembler_instances, armHeadlessPendingTimeout_fn).call(this, address);
|
|
1373
1372
|
}
|
|
1374
1373
|
if (pending.fragments.has(fragment.fragmentCounter)) {
|
|
1375
1374
|
__privateMethod(this, _MFUReassembler_instances, reject_fn).call(this, "fragment-counter-mismatch", "duplicate queued continuation counter would replace retained media");
|
|
1376
1375
|
}
|
|
1377
1376
|
pending.fragments.set(fragment.fragmentCounter, fragment);
|
|
1378
|
-
if (reAnchored) __privateMethod(this, _MFUReassembler_instances, armHeadlessPendingTimeout_fn).call(this, address);
|
|
1379
1377
|
};
|
|
1380
1378
|
drainPendingContinuations_fn = function(address, runKey) {
|
|
1381
1379
|
while (true) {
|
|
@@ -1666,18 +1664,11 @@ clearPendingTimeout_fn = function(address) {
|
|
|
1666
1664
|
/**
|
|
1667
1665
|
* A queue whose run closed without completing is headless again and expires
|
|
1668
1666
|
* from its own first arrival, exactly as it would had the head never come.
|
|
1669
|
-
*
|
|
1670
|
-
* An empty queue is not armed: it holds no data unit that could fail to
|
|
1671
|
-
* complete, so there is nothing for a deadline to expire. Both arming sites
|
|
1672
|
-
* take that test through `parkedRunHoldsASlot` rather than filtering on the
|
|
1673
|
-
* open run alone, which is how this engine reaches Rust's answer — its
|
|
1674
|
-
* `next_timeout_at` derives candidate deadlines from the queue's live
|
|
1675
|
-
* entries, so an empty queue yields none (BLO-32420).
|
|
1676
1667
|
*/
|
|
1677
1668
|
armHeadlessPendingTimeout_fn = function(address) {
|
|
1678
1669
|
const pending = __privateGet(this, _pendingContinuations).get(address);
|
|
1679
1670
|
if (pending === void 0 || pending.timeoutId !== void 0 || __privateGet(this, _timeoutMs) === null) return;
|
|
1680
|
-
if (
|
|
1671
|
+
if (__privateMethod(this, _MFUReassembler_instances, openRunAt_fn).call(this, address) !== void 0) return;
|
|
1681
1672
|
pending.timeoutId = setTimeout(
|
|
1682
1673
|
() => __privateMethod(this, _MFUReassembler_instances, onPendingTimeout_fn).call(this, address),
|
|
1683
1674
|
Math.max(0, pending.startedAt + __privateGet(this, _timeoutMs) - Date.now())
|
|
@@ -1690,10 +1681,6 @@ deletePendingRun_fn = function(address) {
|
|
|
1690
1681
|
onPendingTimeout_fn = function(address) {
|
|
1691
1682
|
const pending = __privateGet(this, _pendingContinuations).get(address);
|
|
1692
1683
|
if (pending === void 0) return;
|
|
1693
|
-
if (!parkedRunHoldsASlot(__privateMethod(this, _MFUReassembler_instances, openRunAt_fn).call(this, address) !== void 0, pending.fragments.size)) {
|
|
1694
|
-
__privateMethod(this, _MFUReassembler_instances, clearPendingTimeout_fn).call(this, address);
|
|
1695
|
-
return;
|
|
1696
|
-
}
|
|
1697
1684
|
this.stats.timedOutMFUs++;
|
|
1698
1685
|
console.warn(
|
|
1699
1686
|
`[MfuReassembler] timeout: run=${address} fragments=${pending.fragments.size} (continuations awaiting first fragment, discarded)`
|
|
@@ -8710,7 +8697,7 @@ function computeFecDeliveryWindowMediaUnits(config, timestampTimescale) {
|
|
|
8710
8697
|
}
|
|
8711
8698
|
return deliveryWindow;
|
|
8712
8699
|
}
|
|
8713
|
-
var _state, _subscription, _hysteresisTimer, _joinDeadlineTimer, _previousPrimary, _manager, _suppressFired,
|
|
8700
|
+
var _state, _subscription, _hysteresisTimer, _joinDeadlineTimer, _previousPrimary, _manager, _suppressFired, _TrackSession_instances, transition_fn, clearHysteresis_fn, armJoinDeadline_fn, clearJoinDeadline_fn, suppress_fn, unsuppress_fn;
|
|
8714
8701
|
var TrackSession = class {
|
|
8715
8702
|
constructor(config, manager) {
|
|
8716
8703
|
__privateAdd(this, _TrackSession_instances);
|
|
@@ -8727,12 +8714,6 @@ var TrackSession = class {
|
|
|
8727
8714
|
// from `failing` (exactly where a starving track sits) was re-subscribed to
|
|
8728
8715
|
// unicast with the host's media still muted: MoQ playing into a dead sink.
|
|
8729
8716
|
__privateAdd(this, _suppressFired, false);
|
|
8730
|
-
// Single FEC authority flag: set by the fec-setup edges (joinStarted,
|
|
8731
|
-
// enterUnicastFallback), cleared by the fec-teardown edge in #transition.
|
|
8732
|
-
// Setup and teardown are paired by construction, so a takeover timeout that
|
|
8733
|
-
// parks the session in `unicast` keeps the decoder the still-joined
|
|
8734
|
-
// transport is feeding, and the later unsubscribe still tears it down.
|
|
8735
|
-
__privateAdd(this, _fecArmed, false);
|
|
8736
8717
|
this.config = config;
|
|
8737
8718
|
__privateSet(this, _manager, manager);
|
|
8738
8719
|
}
|
|
@@ -8807,7 +8788,7 @@ var TrackSession = class {
|
|
|
8807
8788
|
joinStarted() {
|
|
8808
8789
|
if (__privateGet(this, _state) !== "unicast") return;
|
|
8809
8790
|
__privateMethod(this, _TrackSession_instances, transition_fn).call(this, "joining");
|
|
8810
|
-
|
|
8791
|
+
__privateGet(this, _manager).mmtp?.onTrackEvent?.(this.config.trackName, { type: "fec-setup" }, this.config);
|
|
8811
8792
|
}
|
|
8812
8793
|
/**
|
|
8813
8794
|
* any non-fallback state → unicast-fallback. Used when the SSM bridge is
|
|
@@ -8828,7 +8809,7 @@ var TrackSession = class {
|
|
|
8828
8809
|
__privateMethod(this, _TrackSession_instances, clearHysteresis_fn).call(this);
|
|
8829
8810
|
__privateMethod(this, _TrackSession_instances, transition_fn).call(this, "unicast-fallback");
|
|
8830
8811
|
__privateMethod(this, _TrackSession_instances, suppress_fn).call(this);
|
|
8831
|
-
|
|
8812
|
+
__privateGet(this, _manager).mmtp?.onTrackEvent?.(this.config.trackName, { type: "fec-setup" }, this.config);
|
|
8832
8813
|
}
|
|
8833
8814
|
/**
|
|
8834
8815
|
* unicast-fallback → unicast. Called when the SSM bridge appears mid-session
|
|
@@ -8887,18 +8868,23 @@ var TrackSession = class {
|
|
|
8887
8868
|
const prefs = this.config.preferredTransports;
|
|
8888
8869
|
const currentIdx = current ? prefs.indexOf(current) : -1;
|
|
8889
8870
|
const nextMode = prefs[currentIdx + 1];
|
|
8890
|
-
if (nextMode
|
|
8891
|
-
|
|
8892
|
-
|
|
8871
|
+
if (nextMode) {
|
|
8872
|
+
if (nextMode === "moq") {
|
|
8873
|
+
__privateMethod(this, _TrackSession_instances, transition_fn).call(this, "unicast");
|
|
8874
|
+
__privateMethod(this, _TrackSession_instances, unsuppress_fn).call(this);
|
|
8875
|
+
if (this.config.trackType === "audio") {
|
|
8876
|
+
__privateGet(this, _manager).mmtp?.onTrackEvent?.(this.config.trackName, { type: "reset" }, this.config);
|
|
8877
|
+
}
|
|
8878
|
+
} else {
|
|
8879
|
+
__privateMethod(this, _TrackSession_instances, transition_fn).call(this, "joining");
|
|
8880
|
+
__privateMethod(this, _TrackSession_instances, unsuppress_fn).call(this);
|
|
8881
|
+
}
|
|
8882
|
+
} else {
|
|
8883
|
+
__privateMethod(this, _TrackSession_instances, transition_fn).call(this, "unicast");
|
|
8893
8884
|
__privateMethod(this, _TrackSession_instances, unsuppress_fn).call(this);
|
|
8894
|
-
|
|
8895
|
-
|
|
8896
|
-
|
|
8897
|
-
__privateMethod(this, _TrackSession_instances, transition_fn).call(this, "unicast");
|
|
8898
|
-
__privateMethod(this, _TrackSession_instances, disarmFec_fn).call(this);
|
|
8899
|
-
__privateMethod(this, _TrackSession_instances, unsuppress_fn).call(this);
|
|
8900
|
-
if (this.config.trackType === "audio") {
|
|
8901
|
-
__privateGet(this, _manager).mmtp?.onTrackEvent?.(this.config.trackName, { type: "reset" }, this.config);
|
|
8885
|
+
if (this.config.trackType === "audio") {
|
|
8886
|
+
__privateGet(this, _manager).mmtp?.onTrackEvent?.(this.config.trackName, { type: "reset" }, this.config);
|
|
8887
|
+
}
|
|
8902
8888
|
}
|
|
8903
8889
|
}
|
|
8904
8890
|
/** Hysteresis expired → failback to next transport (Claim 9g). */
|
|
@@ -8922,20 +8908,11 @@ var TrackSession = class {
|
|
|
8922
8908
|
get isUnicastFallback() {
|
|
8923
8909
|
return __privateGet(this, _state) === "unicast-fallback";
|
|
8924
8910
|
}
|
|
8925
|
-
/**
|
|
8926
|
-
* True while this track owns a FEC decoder (fec-setup fired, fec-teardown
|
|
8927
|
-
* not yet). Stays true across a takeover timeout that parked the session in
|
|
8928
|
-
* `unicast`; SessionManager.failbackAll uses it to release such sessions.
|
|
8929
|
-
*/
|
|
8930
|
-
get isFecArmed() {
|
|
8931
|
-
return __privateGet(this, _fecArmed);
|
|
8932
|
-
}
|
|
8933
8911
|
dispose() {
|
|
8934
8912
|
__privateMethod(this, _TrackSession_instances, clearHysteresis_fn).call(this);
|
|
8935
8913
|
__privateMethod(this, _TrackSession_instances, clearJoinDeadline_fn).call(this);
|
|
8936
8914
|
__privateSet(this, _state, "idle");
|
|
8937
8915
|
__privateSet(this, _subscription, null);
|
|
8938
|
-
__privateMethod(this, _TrackSession_instances, disarmFec_fn).call(this);
|
|
8939
8916
|
}
|
|
8940
8917
|
};
|
|
8941
8918
|
_state = new WeakMap();
|
|
@@ -8945,20 +8922,20 @@ _joinDeadlineTimer = new WeakMap();
|
|
|
8945
8922
|
_previousPrimary = new WeakMap();
|
|
8946
8923
|
_manager = new WeakMap();
|
|
8947
8924
|
_suppressFired = new WeakMap();
|
|
8948
|
-
_fecArmed = new WeakMap();
|
|
8949
8925
|
_TrackSession_instances = new WeakSet();
|
|
8950
8926
|
// -----------------------------------------------------------------------
|
|
8951
8927
|
// Internal
|
|
8952
8928
|
// -----------------------------------------------------------------------
|
|
8953
|
-
transition_fn = function(to
|
|
8929
|
+
transition_fn = function(to) {
|
|
8954
8930
|
const from = __privateGet(this, _state);
|
|
8955
8931
|
if (from === to) return;
|
|
8956
|
-
const joinDeadlineMs = to === "joining" ? __privateGet(this, _manager).takeoverDeadlineMs : void 0;
|
|
8957
8932
|
__privateSet(this, _state, to);
|
|
8958
8933
|
if (from === "joining") __privateMethod(this, _TrackSession_instances, clearJoinDeadline_fn).call(this);
|
|
8959
|
-
if (
|
|
8934
|
+
if (to === "joining") __privateMethod(this, _TrackSession_instances, armJoinDeadline_fn).call(this);
|
|
8960
8935
|
const fecActive = (s) => s === "joining" || s === "multicast" || s === "amt" || s === "failing" || s === "unicast-fallback";
|
|
8961
|
-
if (
|
|
8936
|
+
if (fecActive(from) && !fecActive(to)) {
|
|
8937
|
+
__privateGet(this, _manager).mmtp?.onTrackEvent?.(this.config.trackName, { type: "fec-teardown" }, this.config);
|
|
8938
|
+
}
|
|
8962
8939
|
__privateGet(this, _manager).callbacks?.onStateChange?.(this.config.trackName, from, to);
|
|
8963
8940
|
};
|
|
8964
8941
|
clearHysteresis_fn = function() {
|
|
@@ -8967,13 +8944,14 @@ clearHysteresis_fn = function() {
|
|
|
8967
8944
|
__privateSet(this, _hysteresisTimer, null);
|
|
8968
8945
|
}
|
|
8969
8946
|
};
|
|
8970
|
-
armJoinDeadline_fn = function(
|
|
8947
|
+
armJoinDeadline_fn = function() {
|
|
8971
8948
|
__privateMethod(this, _TrackSession_instances, clearJoinDeadline_fn).call(this);
|
|
8972
|
-
|
|
8949
|
+
const deadlineMs = __privateGet(this, _manager).takeoverDeadlineMs;
|
|
8950
|
+
if (deadlineMs <= 0) return;
|
|
8973
8951
|
__privateSet(this, _joinDeadlineTimer, setTimeout(() => {
|
|
8974
8952
|
__privateSet(this, _joinDeadlineTimer, null);
|
|
8975
8953
|
if (__privateGet(this, _state) !== "joining") return;
|
|
8976
|
-
__privateMethod(this, _TrackSession_instances, transition_fn).call(this, "unicast"
|
|
8954
|
+
__privateMethod(this, _TrackSession_instances, transition_fn).call(this, "unicast");
|
|
8977
8955
|
__privateGet(this, _manager).callbacks?.onTakeoverTimeout?.(this.config.trackName);
|
|
8978
8956
|
}, deadlineMs));
|
|
8979
8957
|
};
|
|
@@ -8983,18 +8961,6 @@ clearJoinDeadline_fn = function() {
|
|
|
8983
8961
|
__privateSet(this, _joinDeadlineTimer, null);
|
|
8984
8962
|
}
|
|
8985
8963
|
};
|
|
8986
|
-
/** Fire fec-setup exactly once per FEC epoch. */
|
|
8987
|
-
armFec_fn = function() {
|
|
8988
|
-
if (__privateGet(this, _fecArmed)) return;
|
|
8989
|
-
__privateSet(this, _fecArmed, true);
|
|
8990
|
-
__privateGet(this, _manager).mmtp?.onTrackEvent?.(this.config.trackName, { type: "fec-setup" }, this.config);
|
|
8991
|
-
};
|
|
8992
|
-
/** Fire fec-teardown for an armed decoder; no-op when none is armed. */
|
|
8993
|
-
disarmFec_fn = function() {
|
|
8994
|
-
if (!__privateGet(this, _fecArmed)) return;
|
|
8995
|
-
__privateSet(this, _fecArmed, false);
|
|
8996
|
-
__privateGet(this, _manager).mmtp?.onTrackEvent?.(this.config.trackName, { type: "fec-teardown" }, this.config);
|
|
8997
|
-
};
|
|
8998
8964
|
/** Fire onSuppress(true) exactly once per suppression epoch. */
|
|
8999
8965
|
suppress_fn = function() {
|
|
9000
8966
|
if (__privateGet(this, _suppressFired)) return;
|
|
@@ -9007,14 +8973,18 @@ unsuppress_fn = function() {
|
|
|
9007
8973
|
__privateSet(this, _suppressFired, false);
|
|
9008
8974
|
__privateGet(this, _manager).callbacks?.onSuppress?.(this.config.trackName, false);
|
|
9009
8975
|
};
|
|
9010
|
-
var MAX_TAKEOVER_DEADLINE_MS = 2147483647;
|
|
9011
|
-
var _takeoverDeadlineMs, _SessionManager_instances, requireTakeoverDeadlineMs_fn;
|
|
9012
8976
|
var SessionManager = class {
|
|
9013
8977
|
constructor(poolOptions) {
|
|
9014
|
-
__privateAdd(this, _SessionManager_instances);
|
|
9015
8978
|
this.sessions = /* @__PURE__ */ new Map();
|
|
9016
8979
|
this.callbacks = null;
|
|
9017
|
-
|
|
8980
|
+
/**
|
|
8981
|
+
* Takeover deadline (BLO-9413/D9): max time a session may sit in `joining`
|
|
8982
|
+
* without a RAP before returning to `unicast` and firing onTakeoverTimeout.
|
|
8983
|
+
* MoQ is never suppressed during `joining`, so expiry is a silent abandon —
|
|
8984
|
+
* playback never glitches. Hosts tune per stream (e.g. GOP length); 0
|
|
8985
|
+
* disables.
|
|
8986
|
+
*/
|
|
8987
|
+
this.takeoverDeadlineMs = 5e3;
|
|
9018
8988
|
this.pool = new TransportPool(poolOptions);
|
|
9019
8989
|
this.pool.onSubscriptionFailed((sub) => {
|
|
9020
8990
|
for (const trackName of sub.consumers) {
|
|
@@ -9023,56 +8993,18 @@ var SessionManager = class {
|
|
|
9023
8993
|
}
|
|
9024
8994
|
});
|
|
9025
8995
|
}
|
|
9026
|
-
/**
|
|
9027
|
-
* Takeover deadline (BLO-9413/D9): the time a session may sit in `joining`
|
|
9028
|
-
* without a RAP before returning to `unicast` and firing onTakeoverTimeout.
|
|
9029
|
-
* MoQ is never suppressed during `joining`, so expiry abandons the takeover
|
|
9030
|
-
* without a playback glitch. The host derives it from the catalog (RAP
|
|
9031
|
-
* cadence from groupDurationTicks/timescale plus the signaled FEC delivery
|
|
9032
|
-
* window or reorder tolerance) and sets it before addTrack(). There is no
|
|
9033
|
-
* default: an unset value fails addTrack() closed, and reading the getter
|
|
9034
|
-
* before assignment throws the same way, so no host ever holds a
|
|
9035
|
-
* `number | undefined` it could coalesce back into a default.
|
|
9036
|
-
* `hasTakeoverDeadline` answers whether one was admitted. A declared 0
|
|
9037
|
-
* disables the deadline. The value is an integer number of milliseconds:
|
|
9038
|
-
* setTimeout truncates fractions, so a host that divides ticks by a
|
|
9039
|
-
* timescale must round before assigning.
|
|
9040
|
-
*
|
|
9041
|
-
* Assignment validates, so the diagnostic lands at the host's own call site.
|
|
9042
|
-
* That is what bounds the blast radius: `joining` is entered from
|
|
9043
|
-
* joinStarted(), from the transportFailed() failover branch -- itself
|
|
9044
|
-
* reachable from a setTimeout via hysteresisExpired(), where no caller could
|
|
9045
|
-
* catch a throw -- and from the activateMulticast()/activateAmt()/pool-failure
|
|
9046
|
-
* loops, where a throw on one session would abandon its siblings mid-loop
|
|
9047
|
-
* (the split-brain those loops exist to prevent). Refusing a bad value at
|
|
9048
|
-
* assignment means no host mutation can make an already-admitted session
|
|
9049
|
-
* throw out of a transport edge.
|
|
9050
|
-
*/
|
|
9051
|
-
get takeoverDeadlineMs() {
|
|
9052
|
-
return __privateMethod(this, _SessionManager_instances, requireTakeoverDeadlineMs_fn).call(this);
|
|
9053
|
-
}
|
|
9054
|
-
set takeoverDeadlineMs(value) {
|
|
9055
|
-
if (!Number.isInteger(value) || value < 0 || value > MAX_TAKEOVER_DEADLINE_MS) {
|
|
9056
|
-
throw new Error(
|
|
9057
|
-
`[SessionManager] takeoverDeadlineMs must be an integer from 0 to ${MAX_TAKEOVER_DEADLINE_MS} (0 disables it, larger values overflow setTimeout); got ${String(value)}`
|
|
9058
|
-
);
|
|
9059
|
-
}
|
|
9060
|
-
__privateSet(this, _takeoverDeadlineMs, value);
|
|
9061
|
-
}
|
|
9062
|
-
/** True once the host has admitted a deadline; a declared 0 counts. */
|
|
9063
|
-
get hasTakeoverDeadline() {
|
|
9064
|
-
return __privateGet(this, _takeoverDeadlineMs) !== void 0;
|
|
9065
|
-
}
|
|
9066
8996
|
/** Narrow to MMTP callbacks (onTrackEvent). Safe — optional chaining handles PIM-only consumers. */
|
|
9067
8997
|
get mmtp() {
|
|
9068
8998
|
return this.callbacks;
|
|
9069
8999
|
}
|
|
9000
|
+
// -----------------------------------------------------------------------
|
|
9001
|
+
// Track management
|
|
9002
|
+
// -----------------------------------------------------------------------
|
|
9070
9003
|
/** Add a track session from catalog config. */
|
|
9071
9004
|
addTrack(config) {
|
|
9072
9005
|
if (this.sessions.has(config.trackName)) {
|
|
9073
9006
|
throw new Error(`[SessionManager] Track "${config.trackName}" already exists`);
|
|
9074
9007
|
}
|
|
9075
|
-
__privateMethod(this, _SessionManager_instances, requireTakeoverDeadlineMs_fn).call(this);
|
|
9076
9008
|
const session = new TrackSession(config, this);
|
|
9077
9009
|
this.sessions.set(config.trackName, session);
|
|
9078
9010
|
return session;
|
|
@@ -9096,9 +9028,8 @@ var SessionManager = class {
|
|
|
9096
9028
|
* Prevents split-brain between video and audio.
|
|
9097
9029
|
*
|
|
9098
9030
|
* A takeover deadline can return a track from `joining` to `unicast` while
|
|
9099
|
-
* the multicast socket keeps delivering packets
|
|
9100
|
-
*
|
|
9101
|
-
* unicast and promotes multicast without a second fec-setup.
|
|
9031
|
+
* the multicast socket keeps delivering packets. If a valid RAP arrives
|
|
9032
|
+
* later, allow that late-RAP edge to suppress unicast and promote multicast.
|
|
9102
9033
|
*/
|
|
9103
9034
|
activateMulticast() {
|
|
9104
9035
|
for (const [, session] of this.sessions) {
|
|
@@ -9130,17 +9061,13 @@ var SessionManager = class {
|
|
|
9130
9061
|
* and they must drain uninterrupted across transport-state events.
|
|
9131
9062
|
*
|
|
9132
9063
|
* Coherence invariant (BLO-9413): after this returns, every non-fallback
|
|
9133
|
-
* session is `unicast` (or `idle`)
|
|
9134
|
-
*
|
|
9135
|
-
*
|
|
9136
|
-
* and a session that a takeover timeout parked in `unicast` with its decoder
|
|
9137
|
-
* still armed is cycled too, because this transport edge is what releases
|
|
9138
|
-
* that decoder (unsubscribe fires fec-teardown).
|
|
9064
|
+
* session is `unicast` (or `idle`) AND unsuppressed — unsubscribe() unwinds
|
|
9065
|
+
* any outstanding suppression regardless of the state it tears down from
|
|
9066
|
+
* (`failing` included; see TrackSession.#suppressFired).
|
|
9139
9067
|
*/
|
|
9140
9068
|
failbackAll() {
|
|
9141
9069
|
for (const [, session] of this.sessions) {
|
|
9142
|
-
|
|
9143
|
-
if (parkedWithFec || session.state !== "idle" && session.state !== "unicast" && session.state !== "unicast-fallback") {
|
|
9070
|
+
if (session.state !== "idle" && session.state !== "unicast" && session.state !== "unicast-fallback") {
|
|
9144
9071
|
session.unsubscribe();
|
|
9145
9072
|
session.subscribe();
|
|
9146
9073
|
}
|
|
@@ -9224,27 +9151,6 @@ var SessionManager = class {
|
|
|
9224
9151
|
this.callbacks = null;
|
|
9225
9152
|
}
|
|
9226
9153
|
};
|
|
9227
|
-
_takeoverDeadlineMs = new WeakMap();
|
|
9228
|
-
_SessionManager_instances = new WeakSet();
|
|
9229
|
-
// -----------------------------------------------------------------------
|
|
9230
|
-
// Track management
|
|
9231
|
-
// -----------------------------------------------------------------------
|
|
9232
|
-
/**
|
|
9233
|
-
* The admitted takeover deadline. Throws only when the host never set one,
|
|
9234
|
-
* every other invalid value being refused by the setter, and returns a
|
|
9235
|
-
* declared 0 as 0. The getter and addTrack() both route through it, so a
|
|
9236
|
-
* session cannot exist without an admitted deadline, which is what makes
|
|
9237
|
-
* the #transition() read unable to throw on an already-admitted session.
|
|
9238
|
-
*/
|
|
9239
|
-
requireTakeoverDeadlineMs_fn = function() {
|
|
9240
|
-
const value = __privateGet(this, _takeoverDeadlineMs);
|
|
9241
|
-
if (value === void 0) {
|
|
9242
|
-
throw new Error(
|
|
9243
|
-
"[SessionManager] takeoverDeadlineMs is unset; set a catalog-derived takeover deadline (0 disables it) before adding tracks"
|
|
9244
|
-
);
|
|
9245
|
-
}
|
|
9246
|
-
return value;
|
|
9247
|
-
};
|
|
9248
9154
|
|
|
9249
9155
|
// src/fec-manager.ts
|
|
9250
9156
|
var MIN_INTERLEAVE_DEPTH_MS = 33;
|
|
@@ -17912,7 +17818,6 @@ export {
|
|
|
17912
17818
|
FecStarvationDetector,
|
|
17913
17819
|
KEYFRAME_LOST_TIMEOUT_SLACK,
|
|
17914
17820
|
LOCHeaderExtensionId,
|
|
17915
|
-
MAX_TAKEOVER_DEADLINE_MS,
|
|
17916
17821
|
MFUReassembler,
|
|
17917
17822
|
MediaRouter,
|
|
17918
17823
|
MfuReassemblyError,
|