livekit / python-sdks

LiveKit real-time and server SDKs for Python

Home Page:https://docs.livekit.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Question about frame buffering

karrih opened this issue · comments

Hi,

I have a question about the frame buffering logic. It seems that the application can set maximum capacity for the queue when constructing rtc.VideoStream:

video_stream = rtc.VideoStream(track, capacity=1)

This is useful, since I consume frames at a slower rate than what the video track produces, and I only want to sample the latest video frame at each iteration. But it seems that the frame events themselves originate from the following _ffi_queue, which in turn is not capped:

event = await self._ffi_queue.wait_for(self._is_event)

Does this mean that even with capacity=1, my app may theoretically incur an arbitrarily large delay due to the internal buffer growing in size?