bugfix
This commit is contained in:
parent
492df342a6
commit
54c9b4c14f
@ -4,6 +4,7 @@ import asyncio
|
|||||||
import collections
|
import collections
|
||||||
import contextlib
|
import contextlib
|
||||||
from appPublic.folderUtils import temp_file
|
from appPublic.folderUtils import temp_file
|
||||||
|
from appPublic.worker import awaitify
|
||||||
from aiortc import MediaStreamTrack
|
from aiortc import MediaStreamTrack
|
||||||
from aiortc.contrib.media import MediaBlackhole, MediaPlayer, MediaRecorder, MediaRelay
|
from aiortc.contrib.media import MediaBlackhole, MediaPlayer, MediaRecorder, MediaRelay
|
||||||
import webrtcvad
|
import webrtcvad
|
||||||
@ -137,6 +138,7 @@ class AudioTrackVad(MediaStreamTrack):
|
|||||||
super().__init__()
|
super().__init__()
|
||||||
self.track = track
|
self.track = track
|
||||||
self.vad = MyVad(callback=onvoiceend)
|
self.vad = MyVad(callback=onvoiceend)
|
||||||
|
self.vad_check = awaitify(self.vad.vad_check)
|
||||||
# self.sample_rate = self.track.getSettings().sampleRate
|
# self.sample_rate = self.track.getSettings().sampleRate
|
||||||
# frameSize = self.track.getSettings().frameSize
|
# frameSize = self.track.getSettings().frameSize
|
||||||
# self.frame_duration_ms = (1000 * frameSize) / self.sample_rate
|
# self.frame_duration_ms = (1000 * frameSize) / self.sample_rate
|
||||||
@ -165,7 +167,7 @@ class AudioTrackVad(MediaStreamTrack):
|
|||||||
try:
|
try:
|
||||||
frames = to16000_160_frames(frame)
|
frames = to16000_160_frames(frame)
|
||||||
for frame in frames:
|
for frame in frames:
|
||||||
await self.vad.vad_check(frame)
|
await self.vad_check(frame)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f'{e=}')
|
print(f'{e=}')
|
||||||
print_exc()
|
print_exc()
|
||||||
|
Loading…
Reference in New Issue
Block a user