From 81fa2019107d29ef87c9f0ce3ebb3b38af8b5a9a Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Mon, 27 Nov 2017 15:43:06 -0500 Subject: [PATCH] init last_signal --- src/zm_monitor.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/zm_monitor.cpp b/src/zm_monitor.cpp index 2995a2259..b2712198e 100644 --- a/src/zm_monitor.cpp +++ b/src/zm_monitor.cpp @@ -352,6 +352,7 @@ Monitor::Monitor( first_alarm_count = 0; last_alarm_count = 0; state = IDLE; + last_signal = false; if ( alarm_frame_count < 1 ) alarm_frame_count = 1; @@ -590,9 +591,9 @@ Monitor::~Monitor() { if ( (deinterlacing & 0xff) == 4) { delete next_buffer.image; } -#if 0 +#if 1 for ( int i = 0; i < image_buffer_count; i++ ) { - delete image_buffer[i]; + delete image_buffer[i].image; } #endif delete[] image_buffer; @@ -1453,11 +1454,12 @@ bool Monitor::Analyse() { if ( state == PREALARM || state == ALARM ) { if ( config.create_analysis_images ) { bool got_anal_image = false; - alarm_image.Assign( *snap_image ); + Image *anal_image = new Image( *snap_image ); + //alarm_image.Assign( *snap_image ); for( int i = 0; i < n_zones; i++ ) { if ( zones[i]->Alarmed() ) { if ( zones[i]->AlarmImage() ) { - alarm_image.Overlay( *(zones[i]->AlarmImage()) ); + anal_image->Overlay( *(zones[i]->AlarmImage()) ); got_anal_image = true; } if ( config.record_event_stats || state == ALARM ) { @@ -1466,7 +1468,9 @@ bool Monitor::Analyse() { } } // end foreach zone if ( got_anal_image ) { - (*analysis_it)->analysis_image = &alarm_image; + (*analysis_it)->analysis_image = anal_image; + } else { + delete anal_image; } } else if ( config.record_event_stats && state == ALARM ) { for ( int i = 0; i < n_zones; i++ ) { @@ -2791,6 +2795,7 @@ int Monitor::Capture() { } } else { captureResult = camera->Capture(*packet); + Debug(2, "Reset timestamp"); gettimeofday( packet->timestamp, NULL ); if ( captureResult < 0 ) { // Unable to capture image for temporary reason