Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix invalid data len in the audioresampler #266

Merged
merged 1 commit into from
Sep 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading