From aa08b6fd049d354dfd6ef4ff947210766e222f48 Mon Sep 17 00:00:00 2001 From: TyrantKingBen <42081911+TyrantKingBen@users.noreply.github.com> Date: Mon, 25 Mar 2024 17:08:20 -0500 Subject: [PATCH] fix: recorder memory usage when a user rejoins --- interactions/api/voice/recorder.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/interactions/api/voice/recorder.py b/interactions/api/voice/recorder.py index 1e585327e..c87324bc1 100644 --- a/interactions/api/voice/recorder.py +++ b/interactions/api/voice/recorder.py @@ -217,10 +217,10 @@ def process_data(self, raw_audio: RawInputAudio) -> None: if raw_audio.ssrc not in self.user_timestamps: if last_timestamp := self.audio.last_timestamps.get(raw_audio.user_id, None): - diff = raw_audio.timestamp - last_timestamp - silence = int(diff * decoder.sample_rate) + silence = raw_audio.timestamp - last_timestamp + frames = int(silence * decoder.sample_rate) log.debug( - f"{self.state.channel.id}::{raw_audio.user_id} - User rejoined, adding {silence} silence frames ({diff} seconds)" + f"{self.state.channel.id}::{raw_audio.user_id} - User rejoined, adding {frames} silence frames ({silence} seconds)" ) else: silence = 0