fix(k1): stabilize live recovery and media admission
This commit is contained in:
@@ -1199,7 +1199,7 @@ test("camera startup watchdog replaces an open-but-silent MSE or WebSocket", ()
|
||||
);
|
||||
});
|
||||
|
||||
test("first media starts one non-sliding first-playable-frame deadline", () => {
|
||||
test("continuing media extends the first-playable-frame deadline", () => {
|
||||
const scheduled = new Map();
|
||||
const cancelled = [];
|
||||
const timeouts = [];
|
||||
@@ -1228,8 +1228,14 @@ test("first media starts one non-sliding first-playable-frame deadline", () => {
|
||||
assert.equal(scheduled.get(playableHandle).timeoutMs, CAMERA_FIRST_PLAYABLE_FRAME_TIMEOUT_MS);
|
||||
|
||||
watchdog.markMediaReceived();
|
||||
assert.equal(nextHandle - 1, playableHandle, "later fragments must not extend the deadline");
|
||||
scheduled.get(playableHandle).callback();
|
||||
const extendedPlayableHandle = nextHandle - 1;
|
||||
assert.notEqual(extendedPlayableHandle, playableHandle);
|
||||
assert.deepEqual(cancelled, [10, playableHandle]);
|
||||
assert.equal(
|
||||
scheduled.get(extendedPlayableHandle).timeoutMs,
|
||||
CAMERA_FIRST_PLAYABLE_FRAME_TIMEOUT_MS,
|
||||
);
|
||||
scheduled.get(extendedPlayableHandle).callback();
|
||||
assert.deepEqual(timeouts, ["first-playable-frame"]);
|
||||
assert.match(
|
||||
cameraStartupWatchdogRecoveryMessage("first-playable-frame"),
|
||||
@@ -1306,6 +1312,7 @@ test("a laptop sleep gap reopens only the exact authoritative live camera transp
|
||||
now: 7_000,
|
||||
documentVisible: true,
|
||||
networkOnline: true,
|
||||
transportHealthy: false,
|
||||
});
|
||||
assert.equal(wake.reopen, true);
|
||||
assert.equal(wake.state.lastReopenAt, 7_000);
|
||||
@@ -1369,15 +1376,16 @@ test("visibility, pageshow and online wake burst owns one replacement decoder",
|
||||
assert.equal(secondWake.state.lastReopenAt, 18_000);
|
||||
});
|
||||
|
||||
test("healthy visible camera heartbeats do not churn its WebSocket or decoder", () => {
|
||||
test("healthy camera survives a long main-thread heartbeat gap without decoder churn", () => {
|
||||
const authority = "camera-authority-acquisition-healthy";
|
||||
let state = initialCameraPlaybackRecoveryState(authority, 1_000);
|
||||
for (const now of [2_000, 3_000, 4_000, 5_000]) {
|
||||
for (const now of [2_000, 3_000, 4_000, 12_000, 25_000]) {
|
||||
const heartbeat = reduceCameraPlaybackRecovery(state, { type: "heartbeat" }, {
|
||||
activeAuthorityIdentity: authority,
|
||||
now,
|
||||
documentVisible: true,
|
||||
networkOnline: true,
|
||||
transportHealthy: true,
|
||||
});
|
||||
assert.equal(heartbeat.reopen, false);
|
||||
state = heartbeat.state;
|
||||
|
||||
Reference in New Issue
Block a user