If no max_fps set we don't care how long it takes to send frame

This commit is contained in:
Isaac Connor 2021-12-17 13:28:13 -05:00
parent edbe726e86
commit 77793da70e
1 changed files with 11 additions and 9 deletions

View File

@ -460,16 +460,18 @@ bool MonitorStream::sendFrame(Image *image, SystemTimePoint timestamp) {
} // Not mpeg } // Not mpeg
TimePoint send_end_time = std::chrono::steady_clock::now(); if (maxfps) {
TimePoint::duration frame_send_time = send_end_time - send_start_time; TimePoint send_end_time = std::chrono::steady_clock::now();
TimePoint::duration maxfps_milliseconds = Milliseconds(lround(Milliseconds::period::den / maxfps)); 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) { if (frame_send_time > maxfps_milliseconds) {
//maxfps /= 1.5; //maxfps /= 1.5;
Warning("Frame send time %" PRIi64 " msec too slow (> %" PRIi64 ", throttling maxfps to %.3f", Warning("Frame send time %" PRIi64 " msec too slow (> %" PRIi64 ", throttling maxfps to %.3f",
static_cast<int64>(std::chrono::duration_cast<Milliseconds>(frame_send_time).count()), static_cast<int64>(std::chrono::duration_cast<Milliseconds>(frame_send_time).count()),
static_cast<int64>(std::chrono::duration_cast<Milliseconds>(maxfps_milliseconds).count()), static_cast<int64>(std::chrono::duration_cast<Milliseconds>(maxfps_milliseconds).count()),
maxfps); maxfps);
}
} }
last_frame_sent = send_end_time; last_frame_sent = send_end_time;
return true; return true;