Invoke cleanup method on VAD analyzer.
This commit is contained in:
@@ -242,3 +242,12 @@ class VADAnalyzer(ABC):
|
|||||||
self._vad_stopping_count = 0
|
self._vad_stopping_count = 0
|
||||||
|
|
||||||
return self._vad_state
|
return self._vad_state
|
||||||
|
|
||||||
|
async def cleanup(self):
|
||||||
|
"""Clean up resources.
|
||||||
|
|
||||||
|
This method should be called when the object is no longer needed.
|
||||||
|
It waits for all currently executing event handler tasks to finish
|
||||||
|
before returning.
|
||||||
|
"""
|
||||||
|
pass
|
||||||
|
|||||||
@@ -109,6 +109,16 @@ class VADController(BaseObject):
|
|||||||
# Broadcast initial VAD params so other services (e.g. STT) can use them
|
# Broadcast initial VAD params so other services (e.g. STT) can use them
|
||||||
await self.broadcast_frame(SpeechControlParamsFrame, vad_params=self._vad_analyzer.params)
|
await self.broadcast_frame(SpeechControlParamsFrame, vad_params=self._vad_analyzer.params)
|
||||||
|
|
||||||
|
async def cleanup(self):
|
||||||
|
"""Clean up resources.
|
||||||
|
|
||||||
|
This method should be called when the object is no longer needed.
|
||||||
|
It waits for all currently executing event handler tasks to finish
|
||||||
|
before returning.
|
||||||
|
"""
|
||||||
|
if self._vad_analyzer:
|
||||||
|
await self._vad_analyzer.cleanup()
|
||||||
|
|
||||||
async def _handle_audio(self, frame: InputAudioRawFrame):
|
async def _handle_audio(self, frame: InputAudioRawFrame):
|
||||||
"""Process an audio chunk and emit speech events as needed.
|
"""Process an audio chunk and emit speech events as needed.
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user