Keep upcoming frames when trimming queues

This commit is contained in:
2026-06-07 00:28:43 -07:00
parent 2c2b0fdf78
commit a9b180f774

View File

@@ -657,7 +657,7 @@ function trimPendingFrameQueue() {
const overflow = state.pendingFrames.length - maxQueuedFrames; const overflow = state.pendingFrames.length - maxQueuedFrames;
if (overflow > 0) { if (overflow > 0) {
state.pendingFrames.splice(0, overflow); state.pendingFrames.splice(maxQueuedFrames, overflow);
} }
} }
@@ -671,7 +671,7 @@ function trimFrameQueue() {
return; return;
} }
const removed = state.frames.splice(0, overflow); const removed = state.frames.splice(maxQueuedFrames, overflow);
for (const frame of removed) { for (const frame of removed) {
releaseImage(frame.bitmap); releaseImage(frame.bitmap);