From 16ba2010aaa86ddfc358cc706a9014694b0490c1 Mon Sep 17 00:00:00 2001 From: Mark Backman Date: Thu, 13 Feb 2025 09:15:29 -0500 Subject: [PATCH] Refactor process_frame to be more consistent --- src/pipecat/processors/filters/stt_mute_filter.py | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/pipecat/processors/filters/stt_mute_filter.py b/src/pipecat/processors/filters/stt_mute_filter.py index a5430a451..fb1753263 100644 --- a/src/pipecat/processors/filters/stt_mute_filter.py +++ b/src/pipecat/processors/filters/stt_mute_filter.py @@ -156,17 +156,13 @@ class STTMuteFilter(FrameProcessor): """Processes incoming frames and manages muting state.""" await super().process_frame(frame, direction) - # Handle initial state on StartFrame - if isinstance(frame, StartFrame): - # Check if we should start muted - should_mute = await self._should_mute() - if should_mute: - await self._handle_mute_state(True) - - # First determine if we need to change mute state + # Determine if we need to change mute state based on frame type should_mute = None - if isinstance(frame, FunctionCallInProgressFrame): + # Process frames to determine mute state + if isinstance(frame, StartFrame): + should_mute = await self._should_mute() + elif isinstance(frame, FunctionCallInProgressFrame): self._function_call_in_progress = True should_mute = await self._should_mute() elif isinstance(frame, FunctionCallResultFrame):