Revert "Playout video at constant frames per sec"
This reverts commit 586442018ce3efd548200109d9014a2c4379b658.
Reason for revert: no gain
Change-Id: I959cfa0def77e23ad72dd4ace3728014466a22fc
diff --git a/person_detection/base_camera.py b/person_detection/base_camera.py
index fd4d653..28ee57d 100644
--- a/person_detection/base_camera.py
+++ b/person_detection/base_camera.py
@@ -4,38 +4,28 @@
class BaseCamera(object):
process = {} # background process that reads frames from camera
frame = {} # frame queue
- last_frame = {}
- def __init__(self, device):
+ def __init__(self, device=None, idle=False):
"""Start the background camera process if it isn't running yet."""
self.device = device
- BaseCamera.last_frame[self.device] = None
-
if self.device not in BaseCamera.process:
BaseCamera.process[self.device] = None
-
if BaseCamera.process[self.device] is None:
- BaseCamera.frame[device] = Queue(100)
+ self.frame[device] = Queue(100)
# start background frame process
BaseCamera.process[self.device] = Process(target=self._process, args=(self.device))
BaseCamera.process[self.device].start()
# wait until frames are available
- BaseCamera.last_frame[self.device] = self.get_frame()
+ _ = self.get_frame()
def get_frame(self):
"""Return the current camera frame."""
- if BaseCamera.last_frame[self.device] is None:
- BaseCamera.last_frame[self.device] = BaseCamera.frame[self.device].get(block=True)
- return BaseCamera.last_frame[self.device]
- elif not BaseCamera.frame[self.device].empty():
- BaseCamera.last_frame[self.device] = BaseCamera.frame[self.device].get()
- return BaseCamera.last_frame[self.device]
- else:
- return BaseCamera.last_frame[self.device]
+ # blocks
+ return BaseCamera.frame[self.device].get(block=True)
def frames(self):
""""Generator that returns frames from the camera."""