add get_fps to Monitor and use it to adjust the # of frames to cache before writing to db
This commit is contained in:
parent
ab9081e1bf
commit
19e4ef99bc
|
@ -582,7 +582,8 @@ Debug(3, "Writing video");
|
||||||
static char sql[ZM_SQL_MED_BUFSIZ];
|
static char sql[ZM_SQL_MED_BUFSIZ];
|
||||||
|
|
||||||
frame_data.push( new Frame(id, frames, frame_type, timestamp, delta_time, score ) );
|
frame_data.push( new Frame(id, frames, frame_type, timestamp, delta_time, score ) );
|
||||||
if ( frame_data.size() > 10 ) {
|
// The idea is to write out 1/sec
|
||||||
|
if ( frame_data.size() > (int)monitor->get_fps() ) {
|
||||||
WriteDbFrames();
|
WriteDbFrames();
|
||||||
Debug(1, "Adding 10 frames to DB");
|
Debug(1, "Adding 10 frames to DB");
|
||||||
last_db_frame = frames;
|
last_db_frame = frames;
|
||||||
|
|
|
@ -1689,18 +1689,19 @@ Error("Creating new event when one exists");
|
||||||
event->AddFrame( snap_image, *timestamp, score );
|
event->AddFrame( snap_image, *timestamp, score );
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
if ( state == ALARM ) {
|
||||||
|
if ( config.record_event_stats ) {
|
||||||
for( int i = 0; i < n_zones; i++ ) {
|
for( int i = 0; i < n_zones; i++ ) {
|
||||||
if ( zones[i]->Alarmed() ) {
|
if ( zones[i]->Alarmed() ) {
|
||||||
if ( config.record_event_stats && state == ALARM ) {
|
|
||||||
zones[i]->RecordStats( event );
|
zones[i]->RecordStats( event );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( state == PREALARM )
|
|
||||||
Event::AddPreAlarmFrame( snap_image, *timestamp, score );
|
|
||||||
else
|
|
||||||
event->AddFrame( snap_image, *timestamp, score );
|
event->AddFrame( snap_image, *timestamp, score );
|
||||||
|
} else { // ( state == PREALARM )
|
||||||
|
Event::AddPreAlarmFrame( snap_image, *timestamp, score );
|
||||||
}
|
}
|
||||||
|
} // end if analysis_images
|
||||||
if ( event && noteSetMap.size() > 0 )
|
if ( event && noteSetMap.size() > 0 )
|
||||||
event->updateNotes( noteSetMap );
|
event->updateNotes( noteSetMap );
|
||||||
} else if ( state == ALERT ) {
|
} else if ( state == ALERT ) {
|
||||||
|
|
|
@ -530,6 +530,9 @@ public:
|
||||||
#if HAVE_LIBAVCODEC
|
#if HAVE_LIBAVCODEC
|
||||||
//void StreamMpeg( const char *format, int scale=100, int maxfps=10, int bitrate=100000 );
|
//void StreamMpeg( const char *format, int scale=100, int maxfps=10, int bitrate=100000 );
|
||||||
#endif // HAVE_LIBAVCODEC
|
#endif // HAVE_LIBAVCODEC
|
||||||
|
double get_fps( ) const {
|
||||||
|
return fps;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
#define MOD_ADD( var, delta, limit ) (((var)+(limit)+(delta))%(limit))
|
#define MOD_ADD( var, delta, limit ) (((var)+(limit)+(delta))%(limit))
|
||||||
|
|
Loading…
Reference in New Issue