Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue 10845 #11905

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions frigate/output/birdseye.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,9 +282,13 @@ def __init__(
self.canvas = Canvas(width, height, config.birdseye.layout.scaling_factor)
self.stop_event = stop_event
self.inactivity_threshold = config.birdseye.inactivity_threshold
self.min_display_duration = (
config.birdseye.min_display_duration
)# New parameter

if config.birdseye.layout.max_cameras:
self.last_refresh_time = 0
self.last_camera_switch_time = 0 # Track the last switch time

# initialize the frame as black and with the Frigate logo
self.blank_frame = np.zeros(self.yuv_shape, np.uint8)
Expand Down Expand Up @@ -403,9 +407,9 @@ def update_frame(self):

max_cameras = self.config.birdseye.layout.max_cameras
max_camera_refresh = False
if max_cameras:
now = datetime.datetime.now().timestamp()
now = datetime.datetime.now().timestamp()

if max_cameras:
if len(active_cameras) == max_cameras and now - self.last_refresh_time < 10:
# don't refresh cameras too often
active_cameras = self.active_cameras
Expand Down Expand Up @@ -446,11 +450,19 @@ def update_frame(self):
else:
reset_layout = True

# Ensure the current camera has been displayed for at least min_display_duration seconds
if (
len(self.active_cameras) == 1
and now - self.last_camera_switch_time < self.min_display_duration
):
reset_layout = False

# reset the layout if it needs to be different
if reset_layout:
logger.debug("Added new cameras, resetting layout...")
self.clear_frame()
self.active_cameras = active_cameras
self.last_camera_switch_time = now # Update the last switch time

# this also converts added_cameras from a set to a list since we need
# to pop elements in order
Expand Down
Loading