Skip to content

Commit 4a010f9

Browse files
committed
wip
1 parent 361f1ea commit 4a010f9

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

livekit-rtc/livekit/rtc/audio_frame.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@ def __init__(
5959
# can happen if data is bigger than needed
6060
raise ValueError("data length must be a multiple of sizeof(int16)")
6161

62-
self._data = bytearray(data)
62+
self._data = (ctypes.c_int16 * (len(data) // ctypes.sizeof(ctypes.c_int16)))()
63+
ctypes.memmove(self._data, bytes(data), len(data))
6364
self._sample_rate = sample_rate
6465
self._num_channels = num_channels
6566
self._samples_per_channel = samples_per_channel
@@ -133,7 +134,7 @@ def data(self) -> memoryview:
133134
Returns:
134135
memoryview: A memory view of the audio data.
135136
"""
136-
return memoryview(self._data).cast("h")
137+
return memoryview(self._data).cast("B").cast("h")
137138

138139
@property
139140
def sample_rate(self) -> int:

livekit-rtc/rust-sdks

Submodule rust-sdks updated 63 files

0 commit comments

Comments
 (0)