From d10ab54c44acd70c09c71be181404fc97dcde779 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?The=CC=81o=20Monnom?= Date: Fri, 27 Sep 2024 20:30:48 -0700 Subject: [PATCH] Update audio_resampler.py --- livekit-rtc/livekit/rtc/audio_resampler.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/livekit-rtc/livekit/rtc/audio_resampler.py b/livekit-rtc/livekit/rtc/audio_resampler.py index 1d8c0adf..c821d3b8 100644 --- a/livekit-rtc/livekit/rtc/audio_resampler.py +++ b/livekit-rtc/livekit/rtc/audio_resampler.py @@ -93,7 +93,7 @@ def push(self, data: bytearray | AudioFrame) -> list[AudioFrame]: Raises: Exception: If there is an error during resampling. """ - bdata = data if isinstance(data, bytearray) else data.data + bdata = data if isinstance(data, bytearray) else data.data.cast("b") req = proto_ffi.FfiRequest() req.push_sox_resampler.resampler_handle = self._ffi_handle.handle @@ -144,8 +144,8 @@ def flush(self) -> list[AudioFrame]: if not resp.flush_sox_resampler.output_ptr: return [] - cdata = (ctypes.c_int8 * resp.push_sox_resampler.size).from_address( - resp.push_sox_resampler.output_ptr + cdata = (ctypes.c_int8 * resp.flush_sox_resampler.size).from_address( + resp.flush_sox_resampler.output_ptr ) output_data = bytearray(cdata) return [