Set shared_data->score before state transitions so that linked monitors pick it up. Should help with missed linked events

This commit is contained in:
Isaac Connor 2022-02-18 17:44:23 -05:00
parent fc541ac57d
commit dc8f1bc8ed
1 changed files with 5 additions and 3 deletions

View File

@ -1822,8 +1822,8 @@ bool Monitor::Analyse() {
Debug(1, "Linked monitor %d %s is connected", Debug(1, "Linked monitor %d %s is connected",
linked_monitors[i]->Id(), linked_monitors[i]->Name()); linked_monitors[i]->Id(), linked_monitors[i]->Name());
if (linked_monitors[i]->hasAlarmed()) { if (linked_monitors[i]->hasAlarmed()) {
Debug(1, "Linked monitor %d %s is alarmed", Debug(1, "Linked monitor %d %s is alarmed score will be %d",
linked_monitors[i]->Id(), linked_monitors[i]->Name()); linked_monitors[i]->Id(), linked_monitors[i]->Name(), linked_monitors[i]->lastFrameScore());
if (!event) { if (!event) {
if (first_link) { if (first_link) {
if (cause.length()) if (cause.length())
@ -1948,6 +1948,9 @@ bool Monitor::Analyse() {
} // end if active and doing motion detection } // 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 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 ((score > 0) or ((snap->score > 0) and (function != MONITOR))) {
if ((state == IDLE) || (state == TAPE) || (state == PREALARM)) { if ((state == IDLE) || (state == TAPE) || (state == PREALARM)) {
@ -2160,7 +2163,6 @@ bool Monitor::Analyse() {
last_signal = signal; last_signal = signal;
} // end if videostream } // end if videostream
} // end if signal } // end if signal
shared_data->last_frame_score = score;
} else { } else {
Debug(3, "trigger == off"); Debug(3, "trigger == off");
if (event) { if (event) {