Merge pull request #3628 from pipecat-ai/mb/broadcast-speech-control-params-frame

Fix: Broadcast SpeechControlParamsFrame from VADController
This commit is contained in:
Mark Backman
2026-02-03 18:44:15 -05:00
committed by GitHub
5 changed files with 44 additions and 12 deletions

View File

@@ -106,6 +106,8 @@ class VADController(BaseObject):
async def _start(self, frame: StartFrame):
self._vad_analyzer.set_sample_rate(frame.audio_in_sample_rate)
# 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 _handle_audio(self, frame: InputAudioRawFrame):
"""Process an audio chunk and emit speech events as needed.

View File

@@ -93,8 +93,10 @@ class VADProcessor(FrameProcessor):
"""
await super().process_frame(frame, direction)
# Forward the frame first, then let VAD controller process. This ensures:
# 1. StartFrame reaches downstream before SpeechControlParamsFrame is broadcast
# 2. Audio flows through immediately while VAD detection happens after
await self.push_frame(frame, direction)
# Let the VAD controller handle the frame
await self._vad_controller.process_frame(frame)
# Always forward the frame
await self.push_frame(frame, direction)