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:
continue
picam = self.open_device(**camera.info.to_dict()) if camera.object is None or camera.object.closed \
else camera.object
if camera.object is None or camera.object.closed:
camera = self.open_device(**camera.info.to_dict())
try:
picam.start_recording(sock, format=stream_format)
camera.object.start_recording(sock, format=stream_format)
while camera.stream_event.is_set():
picam.wait_recording(1)
camera.object.wait_recording(1)
except ConnectionError:
self.logger.info('Client closed connection')
finally: