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

Fix recording segment management #8220

Merged
merged 2 commits into from Oct 18, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
21 changes: 11 additions & 10 deletions frigate/record/maintainer.py
Expand Up @@ -406,6 +406,7 @@ async def move_segment(
return None

def run(self) -> None:
camera_count = len(self.config.cameras.keys())
# Check for new files every 5 seconds
wait_time = 0.0
while not self.stop_event.wait(wait_time):
Expand All @@ -421,7 +422,7 @@ def run(self) -> None:
current_tracked_objects,
motion_boxes,
regions,
) = self.object_recordings_info_queue.get(True, timeout=0.1)
) = self.object_recordings_info_queue.get(True, timeout=0.01)

if frame_time < run_start - stale_frame_count_threshold:
stale_frame_count += 1
Expand All @@ -437,15 +438,15 @@ def run(self) -> None:
)
except queue.Empty:
q_size = self.object_recordings_info_queue.qsize()
if q_size > 5:
logger.warning(
f"object_recordings_info loop queue not empty ({q_size}) - recording segments may be missing"
if q_size > camera_count:
logger.debug(
f"object_recordings_info loop queue not empty ({q_size})."
)
break

if stale_frame_count > 0:
logger.error(
f"Found {stale_frame_count} old frames, segments from recordings may be missing"
logger.warning(
f"Found {stale_frame_count} old frames, segments from recordings may be missing."
)

# empty the audio recordings info queue if audio is enabled
Expand All @@ -458,7 +459,7 @@ def run(self) -> None:
camera,
frame_time,
dBFS,
) = self.audio_recordings_info_queue.get(True, timeout=0.1)
) = self.audio_recordings_info_queue.get(True, timeout=0.01)

if frame_time < run_start - stale_frame_count_threshold:
stale_frame_count += 1
Expand All @@ -472,9 +473,9 @@ def run(self) -> None:
)
except queue.Empty:
q_size = self.audio_recordings_info_queue.qsize()
if q_size > 5:
logger.warning(
f"object_recordings_info loop audio queue not empty ({q_size}) - recording segments may be missing"
if q_size > camera_count:
logger.debug(
f"object_recordings_info loop audio queue not empty ({q_size})."
)
break

Expand Down