don't calc fps if no time has passed
parent
c3cfd096c7
commit
a9419064ef
|
@ -2984,15 +2984,18 @@ Debug(4, "Return from Capture (%d)", captureResult);
|
||||||
} else {
|
} else {
|
||||||
now.tv_sec = image_buffer[index].timestamp->tv_sec;
|
now.tv_sec = image_buffer[index].timestamp->tv_sec;
|
||||||
}
|
}
|
||||||
fps = double(fps_report_interval)/(now.tv_sec-last_fps_time);
|
// If we are too fast, we get div by zero. This seems to happen in the case of audio packets.
|
||||||
Info( "%d -> %d -> %d", fps_report_interval, now, last_fps_time );
|
if ( now.tv_sec != last_fps_time ) {
|
||||||
//Info( "%d -> %d -> %lf -> %lf", now-last_fps_time, fps_report_interval/(now-last_fps_time), double(fps_report_interval)/(now-last_fps_time), fps );
|
fps = double(fps_report_interval)/(now.tv_sec-last_fps_time);
|
||||||
Info( "%s: %d - Capturing at %.2lf fps", name, image_count, fps );
|
Info( "%d -> %d -> %d", fps_report_interval, now.tv_sec, last_fps_time );
|
||||||
last_fps_time = now.tv_sec;
|
//Info( "%d -> %d -> %lf -> %lf", now-last_fps_time, fps_report_interval/(now-last_fps_time), double(fps_report_interval)/(now-last_fps_time), fps );
|
||||||
static char sql[ZM_SQL_SML_BUFSIZ];
|
Info( "%s: %d - Capturing at %.2lf fps", name, image_count, fps );
|
||||||
snprintf( sql, sizeof(sql), "UPDATE Monitors SET CaptureFPS='%.2lf' WHERE Id=%d", fps, id );
|
last_fps_time = now.tv_sec;
|
||||||
if ( mysql_query( &dbconn, sql ) ) {
|
static char sql[ZM_SQL_SML_BUFSIZ];
|
||||||
Error( "Can't run query: %s", mysql_error( &dbconn ) );
|
snprintf( sql, sizeof(sql), "UPDATE Monitors SET CaptureFPS='%.2lf' WHERE Id=%d", fps, id );
|
||||||
|
if ( mysql_query( &dbconn, sql ) ) {
|
||||||
|
Error( "Can't run query: %s", mysql_error( &dbconn ) );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue