From 13611fd8e19b79ada8506dd8625179b49f90c5b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aleix=20Conchillo=20Flaqu=C3=A9?= Date: Fri, 31 Jan 2025 11:04:43 -0800 Subject: [PATCH] AudioBufferProcessor: call callback on CancelFrame --- CHANGELOG.md | 3 +++ src/pipecat/processors/audio/audio_buffer_processor.py | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f9e1e4c34..ca876830f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -69,6 +69,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed +- Fixed an issue in `AudioBufferProcessor` where user callback would not be + called on task cancellation. + - Fixed an issue where `ElevenLabsTTSService` messages would return a 1009 websocket error by increasing the max message size limit to 16MB. diff --git a/src/pipecat/processors/audio/audio_buffer_processor.py b/src/pipecat/processors/audio/audio_buffer_processor.py index 7500a3f9e..eb92c8109 100644 --- a/src/pipecat/processors/audio/audio_buffer_processor.py +++ b/src/pipecat/processors/audio/audio_buffer_processor.py @@ -91,7 +91,7 @@ class AudioBufferProcessor(FrameProcessor): if self._buffer_size > 0 and len(self._user_audio_buffer) > self._buffer_size: await self._call_on_audio_data_handler() - if isinstance(frame, EndFrame): + if isinstance(frame, (CancelFrame, EndFrame)): await self._call_on_audio_data_handler() await self.push_frame(frame, direction)