1 #include "print_latency.h"
9 using namespace std::chrono;
11 void print_latency(const string &header, const ReceivedTimestamps &received_ts, bool is_b_frame, int *frameno)
13 if (received_ts.max_ts == steady_clock::time_point::min())
16 // 101 is chosen so that it's prime, which is unlikely to get the same frame type every time.
17 if (global_flags.print_video_latency && (++*frameno % 101) == 0) {
18 const steady_clock::time_point now = steady_clock::now();
19 printf("%-60s %4.0f ms (lowest-latency input), %4.0f ms (highest-latency input)",
21 1e3 * std::chrono::duration<double>(now - received_ts.max_ts).count(),
22 1e3 * std::chrono::duration<double>(now - received_ts.min_ts).count());
25 printf(" [on B-frame; potential extra latency]\n");