Raise an error when trying to add a video larger than the buffer

This commit is contained in:
Sebastian Goscik
2022-12-08 00:14:08 +00:00
parent 3510a50d0f
commit dd69a18dbf

View File

@@ -160,6 +160,11 @@ class VideoQueue(asyncio.Queue):
Put an item into the queue. If the queue is full, wait until a free
slot is available before adding item.
"""
if len(item[1]) > self._maxsize:
raise ValueError(
f"Item is larger ({human_readable_size(len(item[1]))}) than the size of the buffer ({human_readable_size(self._maxsize)})"
)
while self.full(item):
putter = self._loop.create_future()
self._putters.append(putter)