Spacing, remove dead code, add comments. When implementing CLOSE_ALARM mode, check Alarm Frames against alarm_frame_count instead of 0.

This commit is contained in:
Isaac Connor 2022-02-16 17:27:12 -05:00 committed by Ben Dailey
parent 968acc2d43
commit 347d3c08b6
1 changed files with 5 additions and 7 deletions

View File

@ -1747,7 +1747,7 @@ bool Monitor::Analyse() {
Event::StringSetMap noteSetMap;
#ifdef WITH_GSOAP
if (onvif_event_listener && Event_Poller_Healthy) {
if (onvif_event_listener && Event_Poller_Healthy) {
if (Poll_Trigger_State) {
score += 9;
Debug(1, "Triggered on ONVIF");
@ -1856,9 +1856,6 @@ bool Monitor::Analyse() {
// So...
Debug(1, "Waiting for decode");
packet_lock->wait();
//packetqueue.unlock(packet_lock); // This will delete packet_lock and notify_all
//packetqueue.wait();
////packet_lock->lock();
} // end while ! decoded
if (zm_terminate or analysis_thread->Stopped()) {
delete packet_lock;
@ -1890,7 +1887,7 @@ bool Monitor::Analyse() {
Image v_image(snap->in_frame->width, snap->in_frame->height, 1, ZM_SUBPIX_ORDER_NONE, snap->in_frame->data[0], 0);
ref_image.Assign(v_image);
} else {
Debug(1, "assigning refimage from snap->image");
Debug(1, "assigning refimage from snap->image");
ref_image.Assign(*(snap->image));
}
alarm_image.Assign(*(snap->image));
@ -1956,7 +1953,7 @@ bool Monitor::Analyse() {
if ((state == IDLE) || (state == TAPE) || (state == PREALARM)) {
// If we should end then previous continuous event and start a new non-continuous event
if (event && event->Frames()
&& !event->AlarmFrames()
&& (event->AlarmFrames() < alarm_frame_count)
&& (event_close_mode == CLOSE_ALARM)
// FIXME since we won't be including this snap in the event if we close it, we should be looking at event->duration() instead
&& (event->Duration() >= min_section_length)
@ -2016,7 +2013,7 @@ bool Monitor::Analyse() {
if (
((analysis_image_count - last_alarm_count) > post_event_count)
&&
(event->Duration() >= min_section_length)) {
(event->Duration() >= min_section_length)) {
Info("%s: %03d - Left alarm state (%" PRIu64 ") - %d(%d) images",
name.c_str(), analysis_image_count, event->Id(), event->Frames(), event->AlarmFrames());
if (
@ -2051,6 +2048,7 @@ bool Monitor::Analyse() {
Event::EmptyPreAlarmFrames();
} // end if score or not
// At this point, snap ONLY has motion score, so this adds other sources
if (score > snap->score)
snap->score = score;