Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
theomonnom committed Oct 27, 2023
1 parent bdd9fbe commit 0d5fb79
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
5 changes: 4 additions & 1 deletion livekit-rtc/livekit/rtc/_ffi_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,13 @@ def __init__(self, handle: int) -> None:
self.handle = handle

def __del__(self):
self.dispose()

def dispose(self) -> None:
if self.handle != INVALID_HANDLE:
assert ffi_lib.livekit_ffi_drop_handle(
ctypes.c_uint64(self.handle))

self.handle = INVALID_HANDLE

T = TypeVar('T')

Expand Down
5 changes: 3 additions & 2 deletions livekit-rtc/livekit/rtc/audio_stream.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,10 @@ async def _run(self):
elif audio_event.HasField('eos'):
break

async def aclose(self):
ffi_client.queue.unsubscribe(self._ffi_queue)
del self._ffi_handle

async def aclose(self):
self._ffi_handle.dispose()
await self._task

def __aiter__(self):
Expand Down
7 changes: 4 additions & 3 deletions livekit-rtc/livekit/rtc/video_stream.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,15 @@ async def _run(self):
owned_buffer_info = video_event.frame_received.buffer

frame = VideoFrame(frame_info.timestamp_us, frame_info.rotation,
VideoFrameBuffer.create(owned_buffer_info))
VideoFrameBuffer._from_owned_info(owned_buffer_info))
self._queue.put(frame)
elif video_event.HasField('eos'):
break

async def aclose(self):
ffi_client.queue.unsubscribe(self._ffi_queue)
del self._ffi_handle

async def aclose(self):
self._ffi_handle.dispose()
await self._task

def __aiter__(self):
Expand Down

0 comments on commit 0d5fb79

Please sign in to comment.