Refactor process_frame to be more consistent

This commit is contained in:
Mark Backman
2025-02-13 09:15:29 -05:00
parent 84143cc80c
commit 16ba2010aa

View File

@@ -156,17 +156,13 @@ class STTMuteFilter(FrameProcessor):
"""Processes incoming frames and manages muting state.""" """Processes incoming frames and manages muting state."""
await super().process_frame(frame, direction) await super().process_frame(frame, direction)
# Handle initial state on StartFrame # Determine if we need to change mute state based on frame type
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
should_mute = None 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 self._function_call_in_progress = True
should_mute = await self._should_mute() should_mute = await self._should_mute()
elif isinstance(frame, FunctionCallResultFrame): elif isinstance(frame, FunctionCallResultFrame):