Commit 6e22376d authored by Joel Collins's avatar Joel Collins
Browse files

Start streamer on init and never time out

parent ae8e55fc
Loading
Loading
Loading
Loading
+3 −12
Original line number Diff line number Diff line
@@ -31,12 +31,14 @@ class BaseCamera(metaclass=ABCMeta):
        self.stop = False  # Used to indicate that the stream loop should break

        self.stream_timeout = 20
        self.stream_timeout_enabled = False

        self.stream_active = False
        self.record_active = False
        self.preview_active = False

        # Start the stream worker on init
        self.start_worker()

    @property
    @abstractmethod
    def configuration(self):
@@ -154,17 +156,6 @@ class BaseCamera(metaclass=ABCMeta):
            self.frame = frame
            self.event.set()  # send signal to clients

            # Handle timeout
            if (
                self.stream_timeout_enabled
                and (  # If using timeout
                    time.time() - self.last_access > self.stream_timeout
                )
                and not self.preview_active  # And GPU preview is not active
            ):
                self.frames_iterator.close()
                break

            try:
                if self.stop is True:
                    logging.debug("Worker thread flagged for stop.")