Camera stream writer fixes.

- The readiness condition should be `multiprocessing.Condition`, not
  `threading.Condition` - in most of the cases it will be checked in a
  multiprocess environment.

- Fixed parameter name for `write`.
This commit is contained in:
Fabio Manganiello 2023-05-30 11:06:48 +02:00
parent 4fffabd82a
commit 8b5eb82497
Signed by: blacklight
GPG Key ID: D90FBA7F76362774
1 changed files with 4 additions and 4 deletions

View File

@ -1,7 +1,7 @@
import io
import logging
import multiprocessing
import os
import threading
import time
from abc import ABC, abstractmethod
@ -26,11 +26,11 @@ class VideoWriter(ABC):
self.closed = False
@abstractmethod
def write(self, img: Image):
def write(self, image: Image):
"""
Write an image to the channel.
:param img: PIL Image instance.
:param image: PIL Image instance.
"""
raise NotImplementedError()
@ -76,7 +76,7 @@ class StreamWriter(VideoWriter, ABC):
self.frame: Optional[bytes] = None
self.frame_time: Optional[float] = None
self.buffer = io.BytesIO()
self.ready = threading.Condition()
self.ready = multiprocessing.Condition()
self.sock = sock
def write(self, image: Image):