diff --git a/dep/RtspServer b/dep/RtspServer index 1b40f1661..cd7fd49be 160000 --- a/dep/RtspServer +++ b/dep/RtspServer @@ -1 +1 @@ -Subproject commit 1b40f1661f93f50fd5805f239d1e466a3bcf888f +Subproject commit cd7fd49becad6010a1b8466bfebbd93999a39878 diff --git a/src/zm_image.cpp b/src/zm_image.cpp index 99fcf4ee1..1c58130cc 100644 --- a/src/zm_image.cpp +++ b/src/zm_image.cpp @@ -3306,9 +3306,9 @@ void neon32_armv7_fastblend(const uint8_t* col1, const uint8_t* col2, uint8_t* r __attribute__((noinline)) void neon64_armv8_fastblend(const uint8_t* col1, const uint8_t* col2, uint8_t* result, unsigned long count, double blendpercent) { #if (defined(__aarch64__) && !defined(ZM_STRIP_NEON)) static double current_blendpercent = 0.0; + static int8_t divider = 0; if (current_blendpercent != blendpercent) { - static int8_t divider = 0; /* Attempt to match the blending percent to one of the possible values */ if(blendpercent < 2.34375) { // 1.5625% blending diff --git a/src/zm_monitor.cpp b/src/zm_monitor.cpp index 703db682a..e987e6fd0 100644 --- a/src/zm_monitor.cpp +++ b/src/zm_monitor.cpp @@ -2145,7 +2145,10 @@ bool Monitor::Analyse() { name.c_str(), analysis_image_count, event->Id(), event->Frames(), event->AlarmFrames()); //if ( function != MOCORD || event_close_mode == CLOSE_ALARM || event->Cause() == SIGNAL_CAUSE ) if (event) { - if ((recording == RECORDING_ONMOTION) || (event_close_mode == CLOSE_ALARM) ) { + if ((recording == RECORDING_ONMOTION) + || + (event_close_mode == CLOSE_ALARM || event_close_mode==CLOSE_IDLE) + ) { shared_data->state = state = IDLE; Info("%s: %03d - Closing event %" PRIu64 ", alarm end%s", name.c_str(), analysis_image_count, event->Id(), (function==MOCORD)?", section truncated":"" ); diff --git a/src/zm_utils.cpp b/src/zm_utils.cpp index bc17e5758..6ea4e0dae 100644 --- a/src/zm_utils.cpp +++ b/src/zm_utils.cpp @@ -120,16 +120,18 @@ std::string Join(const StringVector &values, const std::string &delim) { std::string stringtf(const char* format, ...) { va_list args; va_start(args, format); - int size = vsnprintf(nullptr, 0, format, args) + 1; // Extra space for '\0' - va_end(args); - - if (size <= 0) { - throw std::runtime_error("Error during formatting."); - } - - std::unique_ptr buf(new char[size]); va_list args2; va_copy(args2, args); + int size = vsnprintf(nullptr, 0, format, args); + va_end(args); + + if (size < 0) { + va_end(args2); + throw std::runtime_error("Error during formatting."); + } + size += 1; // Extra space for '\0' + + std::unique_ptr buf(new char[size]); vsnprintf(buf.get(), size, format, args2); va_end(args2); diff --git a/src/zm_videostore.cpp b/src/zm_videostore.cpp index abd541535..249ff222a 100644 --- a/src/zm_videostore.cpp +++ b/src/zm_videostore.cpp @@ -501,8 +501,16 @@ bool VideoStore::open() { Debug(1, "using movflags %s", movflags_entry->value); } if ((ret = avformat_write_header(oc, &opts)) < 0) { - Warning("Unable to set movflags trying with defaults."); - ret = avformat_write_header(oc, nullptr); + // we crash if we try again + if (ENOSPC != ret) { + Warning("Unable to set movflags trying with defaults.%d %s", + ret, av_make_error_string(ret).c_str()); + + ret = avformat_write_header(oc, nullptr); + Debug(1, "Done %d", ret); + } else { + Error("ENOSPC. fail"); + } } else if (av_dict_count(opts) != 0) { Info("some options not used, turn on debugging for a list."); AVDictionaryEntry *e = nullptr;