bugfix
This commit is contained in:
parent
54c9b4c14f
commit
2d7705a8cf
@ -1,4 +1,5 @@
|
|||||||
import base64
|
import base64
|
||||||
|
from inspect import isfunction, iscoroutinefunction
|
||||||
from traceback import print_exc
|
from traceback import print_exc
|
||||||
import asyncio
|
import asyncio
|
||||||
import collections
|
import collections
|
||||||
@ -124,6 +125,9 @@ class MyVad(webrtcvad.Vad):
|
|||||||
if duration > 500:
|
if duration > 500:
|
||||||
ret = frames_write_wave(self.voiced_frames)
|
ret = frames_write_wave(self.voiced_frames)
|
||||||
if self.onvoiceend:
|
if self.onvoiceend:
|
||||||
|
if iscoroutinefunction(self.onvoiceend):
|
||||||
|
await self.onvoiceend(ret)
|
||||||
|
else:
|
||||||
self.onvoiceend(ret)
|
self.onvoiceend(ret)
|
||||||
else:
|
else:
|
||||||
print('-----short voice------')
|
print('-----short voice------')
|
||||||
|
Loading…
Reference in New Issue
Block a user