diff --git a/raspberry/roberto/camera/camera_pi_new.py b/raspberry/roberto/camera/camera_pi_new.py index 5e23964..533c9db 100644 --- a/raspberry/roberto/camera/camera_pi_new.py +++ b/raspberry/roberto/camera/camera_pi_new.py @@ -3,22 +3,18 @@ import time import picamera from .base_camera import BaseCamera -from threading import Condition class StreamingOutput(object): def __init__(self): self.frame = None self.buffer = io.BytesIO() - self.condition = Condition() def write(self, buf): if buf.startswith(b'\xff\xd8'): # New frame, copy the existing buffer's content and notify all # clients it's available self.buffer.truncate() - with self.condition: - self.frame = self.buffer.getvalue() - self.condition.notify_all() + self.frame = self.buffer.getvalue() self.buffer.seek(0) return self.buffer.write(buf) @@ -38,9 +34,6 @@ class Camera(BaseCamera): camera.start_recording(output, format='mjpeg') while True: - with output.condition: - output.condition.wait() - frame = output.frame #yield b'--FRAME\r\n' - yield frame + yield output.frame #yield b'\r\n'