From 1dd19d425a51f74031b65f7e5f1fa47d82ab9c70 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Wed, 13 Oct 2021 15:01:46 -0400 Subject: [PATCH] always correct decoding_enable, as zms needs to know it's correct value --- src/zm_monitor.cpp | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/src/zm_monitor.cpp b/src/zm_monitor.cpp index 59f11daaf..f82f9a523 100644 --- a/src/zm_monitor.cpp +++ b/src/zm_monitor.cpp @@ -482,8 +482,18 @@ void Monitor::Load(MYSQL_ROW dbrow, bool load_zones=true, Purpose p = QUERY) { Debug(1, "Have camera type %s", CameraType_Strings[type].c_str()); col++; function = (Function)atoi(dbrow[col]); col++; - enabled = dbrow[col] ? atoi(dbrow[col]) : 0; col++; - decoding_enabled = dbrow[col] ? atoi(dbrow[col]) : 0; col++; + enabled = dbrow[col] ? atoi(dbrow[col]) : false; col++; + decoding_enabled = dbrow[col] ? atoi(dbrow[col]) : false; col++; + decoding_enabled = !( + ( function == RECORD or function == NODECT ) + and + ( savejpegs == 0 ) + and + ( videowriter == PASSTHROUGH ) + and + !decoding_enabled + ); + Debug(1, "Decoding enabled: %d", decoding_enabled); ReloadLinkedMonitors(dbrow[col]); col++; @@ -655,18 +665,6 @@ void Monitor::Load(MYSQL_ROW dbrow, bool load_zones=true, Purpose p = QUERY) { Error("Can't mkdir %s: %s", monitor_dir.c_str(), strerror(errno)); } - // Do this here to save a few cycles with all the comparisons - decoding_enabled = !( - ( function == RECORD or function == NODECT ) - and - ( savejpegs == 0 ) - and - ( videowriter == PASSTHROUGH ) - and - !decoding_enabled - ); - Debug(1, "Decoding enabled: %d", decoding_enabled); - if ( config.record_diag_images ) { if ( config.record_diag_images_fifo ) { diag_path_ref = stringtf("%s/diagpipe-r-%d.jpg", staticConfig.PATH_SOCKS.c_str(), id);