From 28409b8688a152776f7e59eb07b6ae14f306dcf9 Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Fri, 25 Sep 2020 17:34:53 +0200 Subject: [PATCH] The device should be released after each streaming session --- platypush/plugins/camera/pi/__init__.py | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/platypush/plugins/camera/pi/__init__.py b/platypush/plugins/camera/pi/__init__.py index a397a38087..b4b0f2fcad 100644 --- a/platypush/plugins/camera/pi/__init__.py +++ b/platypush/plugins/camera/pi/__init__.py @@ -132,7 +132,7 @@ class CameraPiPlugin(CameraPlugin): return self.status() - def streaming_thread(self, camera: Camera, stream_format: str, duration: Optional[float] = None): + def streaming_thread(self, camera: PiCamera, stream_format: str, duration: Optional[float] = None): server_socket = self._prepare_server_socket(camera) sock = None streaming_started_time = time.time() @@ -159,18 +159,10 @@ class CameraPiPlugin(CameraPlugin): sock.close() except Exception as e: self.logger.warning('Error while closing client socket: {}'.format(str(e))) + + self.release_device(camera) finally: self._cleanup_stream(camera, server_socket, sock) - try: - camera.object.stop_recording() - except Exception as e: - self.logger.warning('Error while stopping camera recording: {}'.format(str(e))) - - try: - camera.object.close() - except Exception as e: - self.logger.warning('Error while closing camera: {}'.format(str(e))) - self.logger.info('Stopped camera stream') @action