Not storing anymore the last frames received to display them in the idle processor.
This commit is contained in:
@@ -777,7 +777,6 @@ class PipelineTask(BasePipelineTask):
|
||||
"""
|
||||
running = True
|
||||
last_frame_time = 0
|
||||
frame_buffer = deque(maxlen=10) # Store last 10 frames
|
||||
|
||||
while running:
|
||||
try:
|
||||
@@ -785,9 +784,6 @@ class PipelineTask(BasePipelineTask):
|
||||
self._idle_queue.get(), timeout=self._idle_timeout_secs
|
||||
)
|
||||
|
||||
if not isinstance(frame, InputAudioRawFrame):
|
||||
frame_buffer.append(frame)
|
||||
|
||||
if isinstance(frame, StartFrame) or isinstance(frame, self._idle_timeout_frames):
|
||||
# If we find a StartFrame or one of the frames that prevents a
|
||||
# time out we update the time.
|
||||
@@ -798,7 +794,7 @@ class PipelineTask(BasePipelineTask):
|
||||
# valid frames.
|
||||
diff_time = time.time() - last_frame_time
|
||||
if diff_time >= self._idle_timeout_secs:
|
||||
running = await self._idle_timeout_detected(frame_buffer)
|
||||
running = await self._idle_timeout_detected()
|
||||
# Reset `last_frame_time` so we don't trigger another
|
||||
# immediate idle timeout if we are not cancelling. For
|
||||
# example, we might want to force the bot to say goodbye
|
||||
@@ -808,14 +804,11 @@ class PipelineTask(BasePipelineTask):
|
||||
self._idle_queue.task_done()
|
||||
|
||||
except asyncio.TimeoutError:
|
||||
running = await self._idle_timeout_detected(frame_buffer)
|
||||
running = await self._idle_timeout_detected()
|
||||
|
||||
async def _idle_timeout_detected(self, last_frames: Deque[Frame]) -> bool:
|
||||
async def _idle_timeout_detected(self) -> bool:
|
||||
"""Handle idle timeout detection and optional cancellation.
|
||||
|
||||
Args:
|
||||
last_frames: Recent frames received before timeout for debugging.
|
||||
|
||||
Returns:
|
||||
Whether the pipeline task should continue running.
|
||||
"""
|
||||
@@ -823,10 +816,7 @@ class PipelineTask(BasePipelineTask):
|
||||
if self._cancelled:
|
||||
return True
|
||||
|
||||
logger.warning("Idle timeout detected. Last 10 frames received:")
|
||||
for i, frame in enumerate(last_frames, 1):
|
||||
logger.warning(f"Frame {i}: {frame}")
|
||||
|
||||
logger.warning("Idle timeout detected.")
|
||||
await self._call_event_handler("on_idle_timeout")
|
||||
if self._cancel_on_idle_timeout:
|
||||
logger.warning(f"Idle pipeline detected, cancelling pipeline task...")
|
||||
|
||||
Reference in New Issue
Block a user