We have to Prime every monitor not just the first one.

pull/3172/head
Isaac Isaac 2021-02-23 13:12:40 -05:00
parent f2143fd092
commit 3eb67fa2fc
1 changed files with 13 additions and 15 deletions

View File

@ -251,25 +251,23 @@ int main(int argc, char *argv[]) {
if (mysql_query(&dbconn, sql)) {
Error("Can't run query: %s", mysql_error(&dbconn));
}
} // end foreach monitor
// Outer primary loop, handles connection to camera
if (monitors[0]->PrimeCapture() <= 0) {
if (prime_capture_log_count % 60) {
Error("Failed to prime capture of initial monitor");
} else {
Debug(1, "Failed to prime capture of initial monitor");
}
prime_capture_log_count ++;
monitors[0]->disconnect();
if (!zm_terminate) {
Debug(1, "Sleeping");
while (monitor->PrimeCapture() <= 0) {
if (prime_capture_log_count % 60) {
Error("Failed to prime capture of initial monitor");
} else {
Debug(1, "Failed to prime capture of initial monitor");
}
prime_capture_log_count ++;
monitor->disconnect();
if (zm_terminate) break;
sleep(5);
if (!monitor->connect()) {
Warning("Couldn't connect to monitor %d", monitor->Id());
}
}
continue;
}
if (zm_terminate) break;
for (std::shared_ptr<Monitor> &monitor : monitors) {
snprintf(sql, sizeof(sql),
"INSERT INTO Monitor_Status (MonitorId,Status) VALUES (%d, 'Connected') ON DUPLICATE KEY UPDATE Status='Connected'",
monitor->Id());