Merge pull request #4120 from pipecat-ai/filipi/krisp-viva-vad-support

Added cleanup() method to VADAnalyzer base class
This commit is contained in:
Filipi da Silva Fuchter
2026-03-24 11:26:53 -04:00
committed by GitHub
4 changed files with 24 additions and 8 deletions

View File

@@ -242,3 +242,12 @@ class VADAnalyzer(ABC):
self._vad_stopping_count = 0
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

View File

@@ -109,6 +109,16 @@ class VADController(BaseObject):
# Broadcast initial VAD params so other services (e.g. STT) can use them
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):
"""Process an audio chunk and emit speech events as needed.