Do proper decapsulation for PiCamera wrapped object when reinitialized

This commit is contained in:
Fabio Manganiello 2020-09-25 18:25:33 +02:00
parent ac42f7eba4
commit 6e6092e4b2

View file

@ -147,13 +147,13 @@ class CameraPiPlugin(CameraPlugin):
if not sock: if not sock:
continue continue
picam = self.open_device(**camera.info.to_dict()) if camera.object is None or camera.object.closed \ if camera.object is None or camera.object.closed:
else camera.object camera = self.open_device(**camera.info.to_dict())
try: try:
picam.start_recording(sock, format=stream_format) camera.object.start_recording(sock, format=stream_format)
while camera.stream_event.is_set(): while camera.stream_event.is_set():
picam.wait_recording(1) camera.object.wait_recording(1)
except ConnectionError: except ConnectionError:
self.logger.info('Client closed connection') self.logger.info('Client closed connection')
finally: finally: