Commit fccc58fd authored by Joel Collins's avatar Joel Collins
Browse files

Added lock acquisition to preview functions

parent 4bf866b6
Loading
Loading
Loading
Loading
+24 −21
Original line number Diff line number Diff line
@@ -327,6 +327,7 @@ class PiCameraStreamer(BaseCamera):
        """Start the on board GPU camera preview."""
        logging.info("Starting the GPU preview")

        with self.lock():
            try:
                if not self.camera.preview:
                    logging.debug("Starting preview")
@@ -351,6 +352,8 @@ class PiCameraStreamer(BaseCamera):

    def stop_preview(self):
        """Stop the on board GPU camera preview."""
        with self.lock():
            if self.camera.preview:
                self.camera.stop_preview()
                self.preview_active = False