Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/lemon-laws-wave.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@livekit/rtc-node": patch
---

Fix negative queue size on captureFrame
2 changes: 1 addition & 1 deletion packages/livekit-rtc/src/audio_source.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ export class AudioSource {
const now = Number(process.hrtime.bigint() / BigInt(1000000));
const elapsed = this.lastCapture === 0 ? 0 : now - this.lastCapture;
const frameDurationMs = (frame.samplesPerChannel / frame.sampleRate) * 1000;
this.currentQueueSize += frameDurationMs - elapsed;
this.currentQueueSize = Math.max(this.currentQueueSize - elapsed, 0) + frameDurationMs;

this.lastCapture = now;

Expand Down
Loading