mirror of
https://github.com/blakeblackshear/frigate.git
synced 2024-11-21 19:07:46 +01:00
Various Bug Fixes (#6768)
* Fix birdseye infinite loop * Fix division by zero
This commit is contained in:
parent
dfd574beeb
commit
ff90db30e6
@ -7,6 +7,7 @@ import queue
|
|||||||
import signal
|
import signal
|
||||||
import subprocess as sp
|
import subprocess as sp
|
||||||
import threading
|
import threading
|
||||||
|
import traceback
|
||||||
from wsgiref.simple_server import make_server
|
from wsgiref.simple_server import make_server
|
||||||
|
|
||||||
import cv2
|
import cv2
|
||||||
@ -430,9 +431,10 @@ class BirdsEyeFrameManager:
|
|||||||
else:
|
else:
|
||||||
# calculate optimal layout
|
# calculate optimal layout
|
||||||
coefficient = 1.0
|
coefficient = 1.0
|
||||||
|
calculating = True
|
||||||
|
|
||||||
# decrease scaling coefficient until height of all cameras can fit into the birdseye canvas
|
# decrease scaling coefficient until height of all cameras can fit into the birdseye canvas
|
||||||
while True:
|
while calculating:
|
||||||
layout_candidate, total_height = calculate_layout(
|
layout_candidate, total_height = calculate_layout(
|
||||||
(canvas_width, canvas_height),
|
(canvas_width, canvas_height),
|
||||||
active_cameras_to_add,
|
active_cameras_to_add,
|
||||||
@ -440,9 +442,13 @@ class BirdsEyeFrameManager:
|
|||||||
)
|
)
|
||||||
|
|
||||||
if (canvas_height * 0.75) < total_height <= canvas_height:
|
if (canvas_height * 0.75) < total_height <= canvas_height:
|
||||||
break
|
calculating = False
|
||||||
elif total_height < canvas_height * 0.75:
|
elif total_height < canvas_height * 0.75:
|
||||||
|
logger.error(
|
||||||
|
f"Canvas ratio is {canvas_height * 0.75} > {total_height} :: {canvas_height / total_height}"
|
||||||
|
)
|
||||||
coefficient += 0.1
|
coefficient += 0.1
|
||||||
|
calculating = False
|
||||||
else:
|
else:
|
||||||
coefficient -= 0.1
|
coefficient -= 0.1
|
||||||
|
|
||||||
@ -473,8 +479,16 @@ class BirdsEyeFrameManager:
|
|||||||
if (now - self.last_output_time) < 1 / 10:
|
if (now - self.last_output_time) < 1 / 10:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
try:
|
||||||
|
updated_frame = self.update_frame()
|
||||||
|
except Exception:
|
||||||
|
updated_frame = False
|
||||||
|
self.active_cameras = []
|
||||||
|
self.camera_layout = 0
|
||||||
|
print(traceback.format_exc())
|
||||||
|
|
||||||
# if the frame was updated or the fps is too low, send frame
|
# if the frame was updated or the fps is too low, send frame
|
||||||
if self.update_frame() or (now - self.last_output_time) > 1:
|
if updated_frame or (now - self.last_output_time) > 1:
|
||||||
self.last_output_time = now
|
self.last_output_time = now
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
@ -241,7 +241,7 @@ class RecordingCleanup(threading.Thread):
|
|||||||
{"id": recording_id} for recording_id in recordings_to_delete
|
{"id": recording_id} for recording_id in recordings_to_delete
|
||||||
]
|
]
|
||||||
|
|
||||||
if len(recordings_to_delete) / recordings.count() > 0.5:
|
if len(recordings_to_delete) / max(1, recordings.count()) > 0.5:
|
||||||
logger.debug(
|
logger.debug(
|
||||||
f"Deleting {(len(recordings_to_delete) / recordings.count()):2f}% of recordings could be due to configuration error. Aborting..."
|
f"Deleting {(len(recordings_to_delete) / recordings.count()):2f}% of recordings could be due to configuration error. Aborting..."
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user