Skip to content

Commit

Permalink
fix invalid data len in the audioresampler (#266)
Browse files Browse the repository at this point in the history
  • Loading branch information
theomonnom authored Sep 28, 2024
1 parent 119f0b5 commit 2495e04
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions livekit-rtc/livekit/rtc/audio_resampler.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 [
Expand Down

0 comments on commit 2495e04

Please sign in to comment.