diff --git a/src/pipecat/transports/network/websocket_server.py b/src/pipecat/transports/network/websocket_server.py index 685c9e8be..08ca9719a 100644 --- a/src/pipecat/transports/network/websocket_server.py +++ b/src/pipecat/transports/network/websocket_server.py @@ -120,7 +120,7 @@ def __init__(self, params: WebsocketServerParams, **kwargs): self._websocket: websockets.WebSocketServerProtocol | None = None - self._audio_buffer = bytes() + self._websocket_audio_buffer = bytes() async def set_client_connection(self, websocket: websockets.WebSocketServerProtocol | None): if self._websocket: @@ -132,10 +132,10 @@ async def write_raw_audio_frames(self, frames: bytes): if not self._websocket: return - self._audio_buffer += frames - while len(self._audio_buffer) >= self._params.audio_frame_size: + self._websocket_audio_buffer += frames + while len(self._websocket_audio_buffer) >= self._params.audio_frame_size: frame = AudioRawFrame( - audio=self._audio_buffer[:self._params.audio_frame_size], + audio=self._websocket_audio_buffer[:self._params.audio_frame_size], sample_rate=self._params.audio_out_sample_rate, num_channels=self._params.audio_out_channels ) @@ -159,7 +159,7 @@ async def write_raw_audio_frames(self, frames: bytes): if proto: await self._websocket.send(proto) - self._audio_buffer = self._audio_buffer[self._params.audio_frame_size:] + self._websocket_audio_buffer = self._websocket_audio_buffer[self._params.audio_frame_size:] class WebsocketServerTransport(BaseTransport):