From 2e0fb198bf351158c8ed916d8e0407cc0c6e3c6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aleix=20Conchillo=20Flaqu=C3=A9?= Date: Tue, 21 Jan 2025 09:42:15 -0800 Subject: [PATCH] frame_processor: allow pushing more frames after EndFrame This can be useful for testing purposes. In real practice, there shouldn't be any frames after an EndFrame is pushed. --- src/pipecat/processors/frame_processor.py | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/pipecat/processors/frame_processor.py b/src/pipecat/processors/frame_processor.py index ae830c52c..228143b2d 100644 --- a/src/pipecat/processors/frame_processor.py +++ b/src/pipecat/processors/frame_processor.py @@ -293,8 +293,7 @@ class FrameProcessor: await self.__input_frame_task async def __input_frame_task_handler(self): - running = True - while running: + while True: try: if self.__should_block_frames: logger.trace(f"{self}: frame processing paused") @@ -311,8 +310,6 @@ class FrameProcessor: if callback: await callback(self, frame, direction) - running = not isinstance(frame, EndFrame) - self.__input_queue.task_done() except asyncio.CancelledError: logger.trace(f"{self}: cancelled input task") @@ -330,12 +327,10 @@ class FrameProcessor: await self.__push_frame_task async def __push_frame_task_handler(self): - running = True - while running: + while True: try: (frame, direction) = await self.__push_queue.get() await self.__internal_push_frame(frame, direction) - running = not isinstance(frame, EndFrame) self.__push_queue.task_done() except asyncio.CancelledError: logger.trace(f"{self}: cancelled push task")