@blockcast/mmt-container 0.4.0-main.bbd83cb48eff → 0.4.0-main.d57ddc6da6dc
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 +70 -11
- package/dist/browser-runtime.js.map +2 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +2 -2
- package/dist/multicast-manager.d.ts +21 -2
- package/dist/multicast-manager.d.ts.map +1 -1
- package/dist/multicast-manager.js +35 -1
- package/dist/multicast-manager.js.map +2 -2
- package/dist/repair-fetch.d.ts +23 -1
- package/dist/repair-fetch.d.ts.map +1 -1
- package/dist/repair-fetch.js +35 -10
- package/dist/repair-fetch.js.map +2 -2
- package/package.json +5 -5
- package/src/index.ts +2 -0
- package/src/multicast-manager.ts +80 -2
- package/src/repair-fetch.ts +79 -14
package/dist/browser-runtime.js
CHANGED
|
@@ -23253,6 +23253,12 @@ var REPAIR_PRIORITY_REASONS = /* @__PURE__ */ new Set([
|
|
|
23253
23253
|
"repair-priority-absent",
|
|
23254
23254
|
"repair-priority-invalid"
|
|
23255
23255
|
]);
|
|
23256
|
+
var REPAIR_SKIP_REASONS = /* @__PURE__ */ new Set([
|
|
23257
|
+
"rtt-unmeasured",
|
|
23258
|
+
"rtt-exceeds-budget",
|
|
23259
|
+
"presentation-delay-unavailable"
|
|
23260
|
+
]);
|
|
23261
|
+
var REPAIR_DEADLINE_BOUNDS = /* @__PURE__ */ new Set(["wait", "presentation", "keyframe", "retention"]);
|
|
23256
23262
|
var GAP_REASONS = {
|
|
23257
23263
|
"rap-lost": "stall",
|
|
23258
23264
|
"rap-unknown": "stall",
|
|
@@ -23275,6 +23281,9 @@ function isSymbolCounts(value) {
|
|
|
23275
23281
|
function isNullableNonNegative(value) {
|
|
23276
23282
|
return value === null || typeof value === "number" && Number.isFinite(value) && value >= 0;
|
|
23277
23283
|
}
|
|
23284
|
+
function isFiniteNumber(value) {
|
|
23285
|
+
return typeof value === "number" && Number.isFinite(value);
|
|
23286
|
+
}
|
|
23278
23287
|
function isRepairLifecycleEvent(value) {
|
|
23279
23288
|
if (!isRecord(value) || value["version"] !== 2) return false;
|
|
23280
23289
|
const block = value["block"];
|
|
@@ -23292,6 +23301,20 @@ function isRepairLifecycleEvent(value) {
|
|
|
23292
23301
|
case "repair-preempted":
|
|
23293
23302
|
case "repair-deferred":
|
|
23294
23303
|
return hasExactKeys(value, ["version", "type", "block"]) && isRepairBlockIdentity(block);
|
|
23304
|
+
case "repair-sent":
|
|
23305
|
+
return hasExactKeys(value, [
|
|
23306
|
+
"version",
|
|
23307
|
+
"type",
|
|
23308
|
+
"block",
|
|
23309
|
+
"priority",
|
|
23310
|
+
"rttMs",
|
|
23311
|
+
"budgetMs",
|
|
23312
|
+
"delayMs",
|
|
23313
|
+
"blockAgeMs",
|
|
23314
|
+
"bound"
|
|
23315
|
+
]) && isRepairBlockIdentity(block) && (value["priority"] === 0 || value["priority"] === 1 || value["priority"] === 2) && isFiniteNumber(value["rttMs"]) && value["rttMs"] > 0 && isFiniteNumber(value["budgetMs"]) && value["budgetMs"] > value["rttMs"] && isNullableNonNegative(value["delayMs"]) && isNullableNonNegative(value["blockAgeMs"]) && value["delayMs"] === null === (value["blockAgeMs"] === null) && REPAIR_DEADLINE_BOUNDS.has(value["bound"]);
|
|
23316
|
+
case "repair-skipped":
|
|
23317
|
+
return hasExactKeys(value, ["version", "type", "block", "reason", "rttMs", "budgetMs"]) && isRepairBlockIdentity(block) && REPAIR_SKIP_REASONS.has(value["reason"]) && isNullableNonNegative(value["rttMs"]) && isFiniteNumber(value["budgetMs"]);
|
|
23295
23318
|
case "repair-priority": {
|
|
23296
23319
|
const blockClass = value["blockClass"];
|
|
23297
23320
|
const action = value["action"];
|
|
@@ -24794,8 +24817,19 @@ var MulticastManager = class {
|
|
|
24794
24817
|
stats.keyframeBudgetHoldMs += extensionMs;
|
|
24795
24818
|
}
|
|
24796
24819
|
/** Record a repair FETCH the scheduler admitted and sent. */
|
|
24797
|
-
noteRepairFetchSent(priority,
|
|
24820
|
+
noteRepairFetchSent(priority, sbn, packetId, catalogTrackName, measurement) {
|
|
24798
24821
|
if (priority === 0) this.#statsFor(packetId, catalogTrackName).keyframeRepairFetchesSent++;
|
|
24822
|
+
this.#emitRepairLifecycle({
|
|
24823
|
+
version: 2,
|
|
24824
|
+
type: "repair-sent",
|
|
24825
|
+
block: repairBlockIdentity(packetId, sbn, catalogTrackName),
|
|
24826
|
+
priority,
|
|
24827
|
+
rttMs: measurement.rttMs,
|
|
24828
|
+
budgetMs: measurement.budgetMs,
|
|
24829
|
+
delayMs: measurement.delayMs,
|
|
24830
|
+
blockAgeMs: measurement.blockAgeMs,
|
|
24831
|
+
bound: measurement.bound
|
|
24832
|
+
});
|
|
24799
24833
|
}
|
|
24800
24834
|
/**
|
|
24801
24835
|
* Record a repair-scheduler decision about a delta block: preempted for
|
|
@@ -26788,7 +26822,7 @@ function wireRepairFetch(mc, opts) {
|
|
|
26788
26822
|
const admit = (entry, now) => {
|
|
26789
26823
|
const budgetMs = entry.deadlineAt - now;
|
|
26790
26824
|
const rttMs = readRtt();
|
|
26791
|
-
if (rttMs !== null && rttMs < budgetMs) return
|
|
26825
|
+
if (rttMs !== null && rttMs < budgetMs) return rttMs;
|
|
26792
26826
|
retire(entry);
|
|
26793
26827
|
releaseHold(entry);
|
|
26794
26828
|
clearRepair(entry.sbn, entry.packetId, entry.catalogTrackName);
|
|
@@ -26799,7 +26833,7 @@ function wireRepairFetch(mc, opts) {
|
|
|
26799
26833
|
entry.packetId,
|
|
26800
26834
|
entry.catalogTrackName
|
|
26801
26835
|
);
|
|
26802
|
-
return
|
|
26836
|
+
return null;
|
|
26803
26837
|
};
|
|
26804
26838
|
const retire = (entry) => {
|
|
26805
26839
|
if (entries.get(entry.key) === entry) entries.delete(entry.key);
|
|
@@ -26831,9 +26865,17 @@ function wireRepairFetch(mc, opts) {
|
|
|
26831
26865
|
return derived.kind === "omit" ? { subscriberPriority: void 0 } : null;
|
|
26832
26866
|
};
|
|
26833
26867
|
const start = (entry, counted = true) => {
|
|
26834
|
-
|
|
26868
|
+
const now = performance.now();
|
|
26869
|
+
const rttMs = admit(entry, now);
|
|
26870
|
+
if (rttMs === null) return;
|
|
26835
26871
|
if (counted) entry.attempts++;
|
|
26836
|
-
mc.noteRepairFetchSent?.(entry.priority, entry.sbn, entry.packetId, entry.catalogTrackName
|
|
26872
|
+
mc.noteRepairFetchSent?.(entry.priority, entry.sbn, entry.packetId, entry.catalogTrackName, {
|
|
26873
|
+
rttMs,
|
|
26874
|
+
budgetMs: entry.deadlineAt - now,
|
|
26875
|
+
delayMs: entry.delayMs,
|
|
26876
|
+
blockAgeMs: entry.anchorAt === null ? null : Math.max(0, now - entry.anchorAt),
|
|
26877
|
+
bound: entry.bound
|
|
26878
|
+
});
|
|
26837
26879
|
const run = { controller: new AbortController(), stopped: null };
|
|
26838
26880
|
entry.running = run;
|
|
26839
26881
|
mc.fecManager.holdBlockForRepair(
|
|
@@ -26980,6 +27022,9 @@ function wireRepairFetch(mc, opts) {
|
|
|
26980
27022
|
);
|
|
26981
27023
|
if (promotedDeadline !== null && promotedDeadline.deadlineAt > entry2.deadlineAt) {
|
|
26982
27024
|
entry2.deadlineAt = promotedDeadline.deadlineAt;
|
|
27025
|
+
entry2.anchorAt = promotedDeadline.anchorAt;
|
|
27026
|
+
entry2.delayMs = promotedDeadline.delayMs;
|
|
27027
|
+
entry2.bound = promotedDeadline.bound;
|
|
26983
27028
|
noteBudget(entry2, promotedDeadline.extensionMs);
|
|
26984
27029
|
}
|
|
26985
27030
|
if (entry2.running) {
|
|
@@ -27005,7 +27050,9 @@ function wireRepairFetch(mc, opts) {
|
|
|
27005
27050
|
if (waitMs === void 0) return null;
|
|
27006
27051
|
const waitDeadlineAt = now + waitMs;
|
|
27007
27052
|
const anchor = mc.fecManager.blockAnchorAtMs(sbn, packetId, catalogTrackName);
|
|
27008
|
-
if (anchor === void 0)
|
|
27053
|
+
if (anchor === void 0) {
|
|
27054
|
+
return { deadlineAt: waitDeadlineAt, extensionMs: 0, anchorAt: null, delayMs: null, bound: "wait" };
|
|
27055
|
+
}
|
|
27009
27056
|
let delayMs;
|
|
27010
27057
|
try {
|
|
27011
27058
|
delayMs = opts.presentationDelayMs(packetId, catalogTrackName);
|
|
@@ -27016,12 +27063,21 @@ function wireRepairFetch(mc, opts) {
|
|
|
27016
27063
|
const retentionMs = mc.fecManager.terminalRetentionMsForPacket(packetId);
|
|
27017
27064
|
if (retentionMs === void 0) return null;
|
|
27018
27065
|
const ceilingAt = Math.min(anchor, earliestGatedFrameAt(packetId, catalogTrackName) ?? anchor) + retentionMs;
|
|
27019
|
-
const
|
|
27020
|
-
|
|
27066
|
+
const at = (delay, delayBound) => {
|
|
27067
|
+
const presentAt = Math.min(anchor + delay, ceilingAt);
|
|
27068
|
+
if (waitDeadlineAt >= presentAt) return { deadlineAt: waitDeadlineAt, bound: "wait" };
|
|
27069
|
+
return { deadlineAt: presentAt, bound: anchor + delay <= ceilingAt ? delayBound : "retention" };
|
|
27070
|
+
};
|
|
27071
|
+
const base = at(delayMs, "presentation");
|
|
27021
27072
|
const budgetMs = keyframeBudgetEligible(blockClass, classifierMode(packetId, catalogTrackName)) && groupCanComplete(sbn, packetId, catalogTrackName) ? readKeyframeBudget(packetId, catalogTrackName) : null;
|
|
27022
|
-
if (budgetMs === null || budgetMs <= delayMs) return {
|
|
27023
|
-
const extended =
|
|
27024
|
-
return {
|
|
27073
|
+
if (budgetMs === null || budgetMs <= delayMs) return { ...base, extensionMs: 0, anchorAt: anchor, delayMs };
|
|
27074
|
+
const extended = at(budgetMs, "keyframe");
|
|
27075
|
+
return {
|
|
27076
|
+
...extended,
|
|
27077
|
+
extensionMs: extended.deadlineAt - base.deadlineAt,
|
|
27078
|
+
anchorAt: anchor,
|
|
27079
|
+
delayMs: budgetMs
|
|
27080
|
+
};
|
|
27025
27081
|
};
|
|
27026
27082
|
const earliestGatedFrameAt = (packetId, catalogTrackName) => {
|
|
27027
27083
|
try {
|
|
@@ -27098,6 +27154,9 @@ function wireRepairFetch(mc, opts) {
|
|
|
27098
27154
|
priority,
|
|
27099
27155
|
subscriberPriority: wire.subscriberPriority,
|
|
27100
27156
|
deadlineAt: deadline.deadlineAt,
|
|
27157
|
+
anchorAt: deadline.anchorAt,
|
|
27158
|
+
delayMs: deadline.delayMs,
|
|
27159
|
+
bound: deadline.bound,
|
|
27101
27160
|
order: enqueueOrder++,
|
|
27102
27161
|
attempts: 0,
|
|
27103
27162
|
running: null
|