From 77793da70ed1701a56d2c1bfed7d782ee0a765d1 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Fri, 17 Dec 2021 13:28:13 -0500 Subject: [PATCH] If no max_fps set we don't care how long it takes to send frame --- src/zm_monitorstream.cpp | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/zm_monitorstream.cpp b/src/zm_monitorstream.cpp index 4ce0eebeb..e2adcf57b 100644 --- a/src/zm_monitorstream.cpp +++ b/src/zm_monitorstream.cpp @@ -460,16 +460,18 @@ bool MonitorStream::sendFrame(Image *image, SystemTimePoint timestamp) { } // Not mpeg - TimePoint send_end_time = std::chrono::steady_clock::now(); - TimePoint::duration frame_send_time = send_end_time - send_start_time; - TimePoint::duration maxfps_milliseconds = Milliseconds(lround(Milliseconds::period::den / maxfps)); + if (maxfps) { + TimePoint send_end_time = std::chrono::steady_clock::now(); + TimePoint::duration frame_send_time = send_end_time - send_start_time; + TimePoint::duration maxfps_milliseconds = Milliseconds(lround(Milliseconds::period::den / maxfps)); - if (frame_send_time > maxfps_milliseconds) { - //maxfps /= 1.5; - Warning("Frame send time %" PRIi64 " msec too slow (> %" PRIi64 ", throttling maxfps to %.3f", - static_cast(std::chrono::duration_cast(frame_send_time).count()), - static_cast(std::chrono::duration_cast(maxfps_milliseconds).count()), - maxfps); + if (frame_send_time > maxfps_milliseconds) { + //maxfps /= 1.5; + Warning("Frame send time %" PRIi64 " msec too slow (> %" PRIi64 ", throttling maxfps to %.3f", + static_cast(std::chrono::duration_cast(frame_send_time).count()), + static_cast(std::chrono::duration_cast(maxfps_milliseconds).count()), + maxfps); + } } last_frame_sent = send_end_time; return true;