Skip to content

Commit

Permalink
fix: use setTimeout intead of setInterval (#1097)
Browse files Browse the repository at this point in the history
  • Loading branch information
LichKing-2234 authored Nov 7, 2023
1 parent d777ce1 commit 9df0579
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions ts/Renderer/RendererManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -390,9 +390,11 @@ export class RendererManager extends IRendererManager {
});
}
};
this.videoFrameUpdateInterval = setInterval(() => {
const render = () => {
this.forEachStream(renderFunc);
}, 1000 / this.renderFps);
this.videoFrameUpdateInterval = setTimeout(render, 1000 / this.renderFps);
};
render();
}

/**
Expand All @@ -401,7 +403,7 @@ export class RendererManager extends IRendererManager {
public stopRender(): void {
this.isRendering = false;
if (this.videoFrameUpdateInterval) {
clearInterval(this.videoFrameUpdateInterval);
clearTimeout(this.videoFrameUpdateInterval);
this.videoFrameUpdateInterval = undefined;
}
}
Expand Down

0 comments on commit 9df0579

Please sign in to comment.