Skip to content

Commit d1c7c15

Browse files
authored
fix crash when zero byte data is pushed into resampler (#527)
1 parent 633f93a commit d1c7c15

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

livekit-rtc/livekit/rtc/audio_resampler.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,8 @@ def push(self, data: bytearray | AudioFrame) -> list[AudioFrame]:
9494
Exception: If there is an error during resampling.
9595
"""
9696
bdata = data if isinstance(data, bytearray) else data.data.cast("b")
97+
if not bdata:
98+
return []
9799

98100
req = proto_ffi.FfiRequest()
99101
req.push_sox_resampler.resampler_handle = self._ffi_handle.handle

0 commit comments

Comments
 (0)