From 2ac4b7183fc6e3b41c4d060ca2842d9b2ccd1793 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aleix=20Conchillo=20Flaqu=C3=A9?= Date: Tue, 17 Dec 2024 16:07:30 -0800 Subject: [PATCH] transport(base output): avoid pushing EndFrame twice --- src/pipecat/transports/base_output.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) 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: