From 4fee4d01e38a2e52aeaf2bf2c4d0a8dd08326f5e 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 | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/src/zm_monitor.cpp b/src/zm_monitor.cpp index 76b23643b..727e9bc51 100644 --- a/src/zm_monitor.cpp +++ b/src/zm_monitor.cpp @@ -474,6 +474,16 @@ void Monitor::Load(MYSQL_ROW dbrow, bool load_zones=true, Purpose p = QUERY) { function = (Function)atoi(dbrow[col]); 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++; @@ -650,18 +660,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);