From dc8f1bc8ed1c202002cc62792af39b47a8d49878 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Fri, 18 Feb 2022 17:44:23 -0500 Subject: [PATCH] Set shared_data->score before state transitions so that linked monitors pick it up. Should help with missed linked events --- src/zm_monitor.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/zm_monitor.cpp b/src/zm_monitor.cpp index 026fad766..71dc9d2d5 100644 --- a/src/zm_monitor.cpp +++ b/src/zm_monitor.cpp @@ -1822,8 +1822,8 @@ bool Monitor::Analyse() { Debug(1, "Linked monitor %d %s is connected", linked_monitors[i]->Id(), linked_monitors[i]->Name()); if (linked_monitors[i]->hasAlarmed()) { - Debug(1, "Linked monitor %d %s is alarmed", - linked_monitors[i]->Id(), linked_monitors[i]->Name()); + Debug(1, "Linked monitor %d %s is alarmed score will be %d", + linked_monitors[i]->Id(), linked_monitors[i]->Name(), linked_monitors[i]->lastFrameScore()); if (!event) { if (first_link) { if (cause.length()) @@ -1948,6 +1948,9 @@ bool Monitor::Analyse() { } // end if active and doing motion detection + // Set this before any state changes so that it's value is picked up immediately by linked monitors + shared_data->last_frame_score = score; + // If motion detecting, score will be > 0 on motion, but if skipping frames, might not be. So also test snap->score if ((score > 0) or ((snap->score > 0) and (function != MONITOR))) { if ((state == IDLE) || (state == TAPE) || (state == PREALARM)) { @@ -2160,7 +2163,6 @@ bool Monitor::Analyse() { last_signal = signal; } // end if videostream } // end if signal - shared_data->last_frame_score = score; } else { Debug(3, "trigger == off"); if (event) {