Skip to content

Commit 8ced98d

Browse files
m8i-51EtienneLescot
authored andcommitted
Remove redundant stall-timeout test, clarify regression rationale
The "long gap before this call" case was mathematically identical to the queue-drain test once now()/sleep() are injected — shifting the fake clock's epoch doesn't change now() - stallWaitStartAt. Replaced with a comment on why the bug can't recur: the function takes no external "last output" timestamp to go stale in the first place.
1 parent 22db7fa commit 8ced98d

1 file changed

Lines changed: 6 additions & 25 deletions

File tree

‎src/lib/exporter/videoExporter.test.ts‎

Lines changed: 6 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,12 @@ describe("getSourceCopyFastPathBlockers", () => {
121121
});
122122
});
123123

124+
// The original bug measured the timeout from the encoder's last *output* event
125+
// (lastEncoderOutputAt), which went stale while the decoder discarded frames inside
126+
// a trim region. waitForEncoderQueueSpace fixes this by starting the clock fresh on
127+
// each call instead of accepting any such external timestamp — by construction, there
128+
// is no "last output" state to go stale, so that regression can't be reintroduced
129+
// without changing this function's signature.
124130
describe("waitForEncoderQueueSpace", () => {
125131
function fakeClock(start = 0) {
126132
let elapsedMs = start;
@@ -201,31 +207,6 @@ describe("waitForEncoderQueueSpace", () => {
201207
).rejects.toThrow("The video encoder stopped responding during export.");
202208
});
203209

204-
// Regression test for the false-positive stall: a long gap *before* this call
205-
// (e.g. the decoder discarding frames inside a trim region) must not count
206-
// against the timeout. Only time spent waiting *inside* this call should.
207-
it("does not throw merely because a long time has already passed before this call", async () => {
208-
// Simulate this call starting two minutes after some unrelated earlier event,
209-
// then having the queue drain almost immediately once we're inside the wait.
210-
const clock = fakeClock(2 * 60 * 1000);
211-
let queueSize = 8;
212-
const sleep = vi.fn(async (ms: number) => {
213-
await clock.sleep(ms);
214-
queueSize = 0;
215-
});
216-
217-
await expect(
218-
waitForEncoderQueueSpace({
219-
getQueueSize: () => queueSize,
220-
maxEncodeQueue: 8,
221-
isCancelled: () => false,
222-
encoderPreference: "prefer-hardware",
223-
now: clock.now,
224-
sleep,
225-
}),
226-
).resolves.toBeUndefined();
227-
});
228-
229210
it("stops waiting without throwing once cancelled", async () => {
230211
const clock = fakeClock();
231212
let cancelled = false;

0 commit comments

Comments
 (0)