Make video download buffer size configurable

This commit is contained in:
Sebastian Goscik
2022-12-08 00:15:11 +00:00
parent dd69a18dbf
commit bba96e9d86
4 changed files with 30 additions and 4 deletions

View File

@@ -37,10 +37,10 @@ async def get_video_length(video: bytes) -> float:
class VideoDownloader:
"""Downloads event video clips from Unifi Protect"""
def __init__(self, protect: ProtectApiClient, download_queue: asyncio.Queue, buffer_size: int = 256):
def __init__(self, protect: ProtectApiClient, download_queue: asyncio.Queue, buffer_size: int = 256 * 1024 * 1024):
self._protect: ProtectApiClient = protect
self._download_queue: asyncio.Queue = download_queue
self.video_queue = VideoQueue(buffer_size * 1024 * 1024)
self.video_queue = VideoQueue(buffer_size)
# Check if `ffprobe` is available
ffprobe = shutil.which('ffprobe')