From 84f1e49712881e1aeb0f47afac7099d782b4356e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aleix=20Conchillo=20Flaqu=C3=A9?= Date: Tue, 24 Mar 2026 13:21:40 -0700 Subject: [PATCH] Enable direct mode for filter processors Enable direct mode on FrameFilter, IdentityFilter, and NullFilter so they can bypass the async queue and process frames synchronously for lower latency. Also pass **kwargs through to parent in FrameFilter. --- src/pipecat/processors/filters/frame_filter.py | 5 +++-- src/pipecat/processors/filters/identity_filter.py | 2 +- src/pipecat/processors/filters/null_filter.py | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/pipecat/processors/filters/frame_filter.py b/src/pipecat/processors/filters/frame_filter.py index 3784409a6..6dfc45a78 100644 --- a/src/pipecat/processors/filters/frame_filter.py +++ b/src/pipecat/processors/filters/frame_filter.py @@ -20,15 +20,16 @@ class FrameFilter(FrameProcessor): automatically allowed to pass through to maintain pipeline integrity. """ - def __init__(self, types: Tuple[Type[Frame], ...]): + def __init__(self, types: Tuple[Type[Frame], ...], **kwargs): """Initialize the frame filter. Args: types: Tuple of frame types that should be allowed to pass through the filter. All other frame types (except SystemFrame and EndFrame) will be blocked. + **kwargs: Additional arguments passed to the parent FrameProcessor. """ - super().__init__() + super().__init__(enable_direct_mode=True, **kwargs) self._types = types # diff --git a/src/pipecat/processors/filters/identity_filter.py b/src/pipecat/processors/filters/identity_filter.py index efb2ffb40..eb6dc55c6 100644 --- a/src/pipecat/processors/filters/identity_filter.py +++ b/src/pipecat/processors/filters/identity_filter.py @@ -28,7 +28,7 @@ class IdentityFilter(FrameProcessor): Args: **kwargs: Additional arguments passed to the parent FrameProcessor. """ - super().__init__(**kwargs) + super().__init__(enable_direct_mode=True, **kwargs) # # Frame processor diff --git a/src/pipecat/processors/filters/null_filter.py b/src/pipecat/processors/filters/null_filter.py index 5c91305b8..2546c7ca4 100644 --- a/src/pipecat/processors/filters/null_filter.py +++ b/src/pipecat/processors/filters/null_filter.py @@ -29,7 +29,7 @@ class NullFilter(FrameProcessor): Args: **kwargs: Additional arguments passed to parent FrameProcessor. """ - super().__init__(**kwargs) + super().__init__(enable_direct_mode=True, **kwargs) # # Frame processor