From ebee72bf65f34ad50784168008ed0d3d2b7b0368 Mon Sep 17 00:00:00 2001 From: BHMSD-bdailey <49526829+BHMSD-bdailey@users.noreply.github.com> Date: Wed, 21 Feb 2024 17:10:18 -0500 Subject: [PATCH 1/2] Prevent events from exceeding the section_length even if we are still in alarm --- src/zm_monitor.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/zm_monitor.cpp b/src/zm_monitor.cpp index 89e47edeb..3aa8b9ce3 100644 --- a/src/zm_monitor.cpp +++ b/src/zm_monitor.cpp @@ -2312,6 +2312,17 @@ bool Monitor::Analyse() { Info("%s: %03d - Closing event %" PRIu64 ", continuous end, alarm begins. Event alarm frames %d < alarm_frame_count %d", name.c_str(), snap->image_index, event->Id(), event->AlarmFrames(), alarm_frame_count); closeEvent(); + // If we should end the event and start a new event because the current event is longer than the request section length + } else if (event->Duration() > section_length) { + Info("%s: %03d - Closing event %" PRIu64 ", section end forced %" PRIi64 " - %" PRIi64 " = %" PRIi64 " >= %" PRIi64 , + name.c_str(), + snap->image_index, + event->Id(), + static_cast(std::chrono::duration_cast(snap->timestamp.time_since_epoch()).count()), + static_cast(std::chrono::duration_cast(event->StartTime().time_since_epoch()).count()), + static_cast(std::chrono::duration_cast(snap->timestamp - event->StartTime()).count()), + static_cast(Seconds(section_length).count())); + closeEvent(); } else { Debug(1, "Not Closing event %" PRIu64 ", continuous end, alarm begins. Event alarm frames %d < alarm_frame_count %d", event->Id(), event->AlarmFrames(), alarm_frame_count); From 025fc939a971caa9ea5e23c3278b6392b977ae9f Mon Sep 17 00:00:00 2001 From: BHMSD-bdailey <49526829+BHMSD-bdailey@users.noreply.github.com> Date: Thu, 22 Feb 2024 07:49:49 -0500 Subject: [PATCH 2/2] Update debug to make it unique --- src/zm_monitor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/zm_monitor.cpp b/src/zm_monitor.cpp index 3aa8b9ce3..ba5ac51cb 100644 --- a/src/zm_monitor.cpp +++ b/src/zm_monitor.cpp @@ -2314,7 +2314,7 @@ bool Monitor::Analyse() { closeEvent(); // If we should end the event and start a new event because the current event is longer than the request section length } else if (event->Duration() > section_length) { - Info("%s: %03d - Closing event %" PRIu64 ", section end forced %" PRIi64 " - %" PRIi64 " = %" PRIi64 " >= %" PRIi64 , + Info("%s: %03d - Closing event %" PRIu64 ", section end forced still alarmed %" PRIi64 " - %" PRIi64 " = %" PRIi64 " >= %" PRIi64 , name.c_str(), snap->image_index, event->Id(),