From 54c9b4c14f1a7e7a9f84f40226fb0899585fe047 Mon Sep 17 00:00:00 2001 From: yumoqing Date: Wed, 18 Sep 2024 16:01:08 +0800 Subject: [PATCH] bugfix --- rtcllm/vad.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/rtcllm/vad.py b/rtcllm/vad.py index 9f6b5b4..15268e8 100644 --- a/rtcllm/vad.py +++ b/rtcllm/vad.py @@ -4,6 +4,7 @@ import asyncio import collections import contextlib from appPublic.folderUtils import temp_file +from appPublic.worker import awaitify from aiortc import MediaStreamTrack from aiortc.contrib.media import MediaBlackhole, MediaPlayer, MediaRecorder, MediaRelay import webrtcvad @@ -137,6 +138,7 @@ class AudioTrackVad(MediaStreamTrack): super().__init__() self.track = track self.vad = MyVad(callback=onvoiceend) + self.vad_check = awaitify(self.vad.vad_check) # self.sample_rate = self.track.getSettings().sampleRate # frameSize = self.track.getSettings().frameSize # self.frame_duration_ms = (1000 * frameSize) / self.sample_rate @@ -165,7 +167,7 @@ class AudioTrackVad(MediaStreamTrack): try: frames = to16000_160_frames(frame) for frame in frames: - await self.vad.vad_check(frame) + await self.vad_check(frame) except Exception as e: print(f'{e=}') print_exc()