diff --git a/src/pipecat/transports/base_output.py b/src/pipecat/transports/base_output.py index fbe337d6d..d6c893e65 100644 --- a/src/pipecat/transports/base_output.py +++ b/src/pipecat/transports/base_output.py @@ -324,6 +324,10 @@ async def _sink_task_handler(self): await self.push_frame(BotSpeakingFrame()) await self.push_frame(BotSpeakingFrame(), FrameDirection.UPSTREAM) + # No need to push EndFrame, it's pushed from process_frame(). + if isinstance(frame, EndFrame): + break + # Handle frame. await self._sink_frame_handler(frame) @@ -333,9 +337,6 @@ async def _sink_task_handler(self): # Send audio. if isinstance(frame, OutputAudioRawFrame): await self.write_raw_audio_frames(frame.audio) - - if isinstance(frame, EndFrame): - break except asyncio.CancelledError: pass except Exception as e: