adding missing audio buffer fix

This commit is contained in:
Vaibhav159
2025-01-23 23:17:18 +05:30
parent fc6aa6eae8
commit 5957ddb038
2 changed files with 8 additions and 0 deletions

View File

@@ -31,6 +31,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Fixed an issue where `OpenAIRealtimeBetaLLMService` function calling resulted - Fixed an issue where `OpenAIRealtimeBetaLLMService` function calling resulted
in an error. in an error.
- Fixed an issue in `AudioBufferProcessor` where the last audio buffer was not
being processed, in cases where the `_user_audio_buffer` was smaller than the
buffer size.
### Performance ### Performance
- Replaced audio resampling library `resampy` with `soxr`. Resampling a 2:21s - Replaced audio resampling library `resampy` with `soxr`. Resampling a 2:21s

View File

@@ -9,6 +9,7 @@ from pipecat.frames.frames import (
Frame, Frame,
InputAudioRawFrame, InputAudioRawFrame,
OutputAudioRawFrame, OutputAudioRawFrame,
EndFrame,
) )
from pipecat.processors.frame_processor import FrameDirection, FrameProcessor from pipecat.processors.frame_processor import FrameDirection, FrameProcessor
@@ -86,6 +87,9 @@ class AudioBufferProcessor(FrameProcessor):
if self._buffer_size > 0 and len(self._user_audio_buffer) > self._buffer_size: if self._buffer_size > 0 and len(self._user_audio_buffer) > self._buffer_size:
await self._call_on_audio_data_handler() await self._call_on_audio_data_handler()
if isinstance(frame, EndFrame):
await self._call_on_audio_data_handler()
await self.push_frame(frame, direction) await self.push_frame(frame, direction)
async def _call_on_audio_data_handler(self): async def _call_on_audio_data_handler(self):