diff --git a/scripts/zmupdate.pl.in b/scripts/zmupdate.pl.in index a35bf5b771..3c9aa04f91 100644 --- a/scripts/zmupdate.pl.in +++ b/scripts/zmupdate.pl.in @@ -941,7 +941,7 @@ if ( $version ) { foreach my $patch ( @files ) { my ( $v ) = $patch =~ /^zm_update\-([\d\.]+)\.sql$/; #PP make sure we use version compare - if ( version->parse('v'.$v) > version->parse('v'.$version) ) { + if ( version->parse('v'.$v) >= version->parse('v'.$version) ) { print("Upgrading DB to $v from $version\n"); if ( patchDB($dbh, $v) ) { my $res = $sth->execute($version) or die( "Can't execute: ".$sth->errstr() ); diff --git a/src/zm_ffmpeg_camera.cpp b/src/zm_ffmpeg_camera.cpp index bf3eb8a878..9f20c3068a 100644 --- a/src/zm_ffmpeg_camera.cpp +++ b/src/zm_ffmpeg_camera.cpp @@ -235,8 +235,9 @@ int FfmpegCamera::Capture(std::shared_ptr &zm_packet) { Info("Unable to read packet from stream %d: error %d \"%s\".", packet->stream_index, ret, av_make_error_string(ret).c_str()); } else { - Error("Unable to read packet from stream %d: error %d \"%s\".", - packet->stream_index, ret, av_make_error_string(ret).c_str()); + logPrintf(Logger::ERROR + monitor->Importance(), + "Unable to read packet from stream %d: error %d \"%s\".", + packet->stream_index, ret, av_make_error_string(ret).c_str()); } return -1; } diff --git a/src/zm_image.cpp b/src/zm_image.cpp index 26e69644c0..fca64dd7f8 100644 --- a/src/zm_image.cpp +++ b/src/zm_image.cpp @@ -258,7 +258,7 @@ Image::Image(const AVFrame *frame, int p_width, int p_height) : static void dont_free(void *opaque, uint8_t *data) { } -int Image::PopulateFrame(AVFrame *frame) { +int Image::PopulateFrame(AVFrame *frame) const { Debug(1, "PopulateFrame: width %d height %d linesize %d colours %d imagesize %d %s", width, height, linesize, colours, size, av_get_pix_fmt_name(imagePixFormat) diff --git a/src/zm_signal.cpp b/src/zm_signal.cpp index efeb38c22c..e988a665bc 100644 --- a/src/zm_signal.cpp +++ b/src/zm_signal.cpp @@ -27,6 +27,7 @@ bool zm_reload = false; bool zm_terminate = false; +bool zm_panic = false; RETSIGTYPE zm_hup_handler(int signal) { // Shouldn't do complex things in signal handlers, logging is complex and can block due to mutexes. @@ -47,6 +48,9 @@ RETSIGTYPE zm_die_handler(int signal) #endif { zm_terminate = true; + if (zm_panic) + Panic("Got signal %d (%s), crashing", signal, strsignal(signal)); + zm_panic = true; Error("Got signal %d (%s), crashing", signal, strsignal(signal)); #if (defined(__i386__) || defined(__x86_64__)) // Get more information if available diff --git a/src/zms.cpp b/src/zms.cpp index f5bca10d77..6f7ee5aaed 100644 --- a/src/zms.cpp +++ b/src/zms.cpp @@ -24,6 +24,8 @@ #include "zm_monitorstream.h" #include "zm_eventstream.h" #include "zm_fifo_stream.h" +#include +#include #include #include @@ -154,6 +156,12 @@ int main(int argc, const char *argv[], char **envp) { monitor_id = atoi(value); if ( source == ZMS_UNKNOWN ) source = ZMS_MONITOR; + } else if ( !strcmp(name, "datetime") ) { + std::tm tm = {}; + std::stringstream ss(value); + ss >> std::get_time(&tm, "%Y-%m-%d %H:%M:%S"); + auto tp = std::chrono::system_clock::from_time_t(std::mktime(&tm)); + event_time = std::chrono::duration_cast(tp.time_since_epoch()).count(); } else if ( !strcmp(name, "time") ) { event_time = atoi(value); } else if ( !strcmp(name, "event") ) { diff --git a/web/includes/actions/monitor.php b/web/includes/actions/monitor.php index e55cfce4eb..854fe04524 100644 --- a/web/includes/actions/monitor.php +++ b/web/includes/actions/monitor.php @@ -101,6 +101,7 @@ 'Exif' => 0, 'RTSPDescribe' => 0, 'V4LMultiBuffer' => '', + 'WallClockTimestamps' => '', 'RecordAudio' => 0, 'Method' => 'raw', 'GroupIds' => array(),