forked from platypush/platypush
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:
parent
4fffabd82a
commit
8b5eb82497
1 changed files with 4 additions and 4 deletions
|
@ -1,7 +1,7 @@
|
||||||
import io
|
import io
|
||||||
import logging
|
import logging
|
||||||
|
import multiprocessing
|
||||||
import os
|
import os
|
||||||
import threading
|
|
||||||
import time
|
import time
|
||||||
|
|
||||||
from abc import ABC, abstractmethod
|
from abc import ABC, abstractmethod
|
||||||
|
@ -26,11 +26,11 @@ class VideoWriter(ABC):
|
||||||
self.closed = False
|
self.closed = False
|
||||||
|
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
def write(self, img: Image):
|
def write(self, image: Image):
|
||||||
"""
|
"""
|
||||||
Write an image to the channel.
|
Write an image to the channel.
|
||||||
|
|
||||||
:param img: PIL Image instance.
|
:param image: PIL Image instance.
|
||||||
"""
|
"""
|
||||||
raise NotImplementedError()
|
raise NotImplementedError()
|
||||||
|
|
||||||
|
@ -76,7 +76,7 @@ class StreamWriter(VideoWriter, ABC):
|
||||||
self.frame: Optional[bytes] = None
|
self.frame: Optional[bytes] = None
|
||||||
self.frame_time: Optional[float] = None
|
self.frame_time: Optional[float] = None
|
||||||
self.buffer = io.BytesIO()
|
self.buffer = io.BytesIO()
|
||||||
self.ready = threading.Condition()
|
self.ready = multiprocessing.Condition()
|
||||||
self.sock = sock
|
self.sock = sock
|
||||||
|
|
||||||
def write(self, image: Image):
|
def write(self, image: Image):
|
||||||
|
|
Loading…
Reference in a new issue