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()