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 [