From edefbfcad68bdf1c8ece4da0ac04f2e0ffd123bc Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Thu, 18 Mar 2021 09:24:27 -0400 Subject: [PATCH] Remove assumptions about Analysis being about motion detection. Fixes mem leaks in Monitor mode --- src/zm_monitor.cpp | 6 ++---- src/zm_monitor.h | 4 ---- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/src/zm_monitor.cpp b/src/zm_monitor.cpp index b17bf97b1..8fc0a507a 100644 --- a/src/zm_monitor.cpp +++ b/src/zm_monitor.cpp @@ -1797,10 +1797,6 @@ void Monitor::UpdateAnalysisFPS() { // If there isn't then we keep pre-event + alarm frames. = pre_event_count bool Monitor::Analyse() { - if (!Enabled()) { - Warning("Shouldn't be doing Analyse when not Enabled"); - return false; - } // if have event, send frames until we find a video packet, at which point do analysis. Adaptive skip should only affect which frames we do analysis on. @@ -3153,10 +3149,12 @@ int Monitor::PrimeCapture() { audio_fifo = new Fifo(shared_data->audio_fifo_path, true); } } // end if rtsp_server + if (decoding_enabled) { if (!decoder_it) decoder_it = packetqueue.get_video_it(false); if (!decoder) decoder = new DecoderThread(this); } + if (!analysis_it) analysis_it = packetqueue.get_video_it(false); if (!analysis_thread) { Debug(1, "Starting an analysis thread for monitor (%d)", id); diff --git a/src/zm_monitor.h b/src/zm_monitor.h index 7969d2eef..f12910597 100644 --- a/src/zm_monitor.h +++ b/src/zm_monitor.h @@ -445,10 +445,6 @@ public: } inline const char *EventPrefix() const { return event_prefix; } inline bool Ready() const { - if ( function <= MONITOR ) { - Error("Should not be calling Ready if the function doesn't include motion detection"); - return false; - } if ( image_count >= ready_count ) { return true; }