Skip to content

Commit

Permalink
transport(base output): avoid pushing EndFrame twice
Browse files Browse the repository at this point in the history
  • Loading branch information
aconchillo committed Dec 18, 2024
1 parent fb9f72d commit 2ac4b71
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/pipecat/transports/base_output.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -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:
Expand Down

0 comments on commit 2ac4b71

Please sign in to comment.