use gevent sleep to prevent mjpeg from blocking

This commit is contained in:
Blake Blackshear 2021-02-24 06:52:33 -06:00
parent 0e8467782b
commit 0344d61b26

View File

@ -356,7 +356,7 @@ def latest_frame(camera_name):
def imagestream(detected_frames_processor, camera_name, fps, height, draw_options): def imagestream(detected_frames_processor, camera_name, fps, height, draw_options):
while True: while True:
# max out at specified FPS # max out at specified FPS
time.sleep(1/fps) gevent.sleep(1/fps)
frame = detected_frames_processor.get_current_frame(camera_name, draw_options) frame = detected_frames_processor.get_current_frame(camera_name, draw_options)
if frame is None: if frame is None:
frame = np.zeros((height,int(height*16/9),3), np.uint8) frame = np.zeros((height,int(height*16/9),3), np.uint8)