fixup EmptyPreAlarmFrames
This commit is contained in:
parent
41dfb8ae38
commit
a0be7b1fcb
|
@ -153,12 +153,14 @@ class Event {
|
||||||
return pre_alarm_count;
|
return pre_alarm_count;
|
||||||
}
|
}
|
||||||
static void EmptyPreAlarmFrames() {
|
static void EmptyPreAlarmFrames() {
|
||||||
if ( pre_alarm_count > 0 ) {
|
while ( pre_alarm_count > 0 ) {
|
||||||
for ( int i = 0; i < MAX_PRE_ALARM_FRAMES; i++ ) {
|
int i = pre_alarm_count - 1;
|
||||||
delete pre_alarm_data[i].image;
|
delete pre_alarm_data[i].image;
|
||||||
|
pre_alarm_data[i].image = NULL;
|
||||||
|
if ( pre_alarm_data[i].alarm_frame ) {
|
||||||
delete pre_alarm_data[i].alarm_frame;
|
delete pre_alarm_data[i].alarm_frame;
|
||||||
|
pre_alarm_data[i].alarm_frame = NULL;
|
||||||
}
|
}
|
||||||
memset( pre_alarm_data, 0, sizeof(pre_alarm_data) );
|
|
||||||
}
|
}
|
||||||
pre_alarm_count = 0;
|
pre_alarm_count = 0;
|
||||||
}
|
}
|
||||||
|
@ -173,7 +175,11 @@ class Event {
|
||||||
}
|
}
|
||||||
void SavePreAlarmFrames() {
|
void SavePreAlarmFrames() {
|
||||||
for ( int i = 0; i < pre_alarm_count; i++ ) {
|
for ( int i = 0; i < pre_alarm_count; i++ ) {
|
||||||
AddFrame( pre_alarm_data[i].image, pre_alarm_data[i].timestamp, pre_alarm_data[i].score, pre_alarm_data[i].alarm_frame );
|
AddFrame(
|
||||||
|
pre_alarm_data[i].image,
|
||||||
|
pre_alarm_data[i].timestamp,
|
||||||
|
pre_alarm_data[i].score,
|
||||||
|
pre_alarm_data[i].alarm_frame);
|
||||||
}
|
}
|
||||||
EmptyPreAlarmFrames();
|
EmptyPreAlarmFrames();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue