]> git.sesse.net Git - nageru/commitdiff
Move find_received_timestamp() into print_latency.h, so that multiple consumers can...
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Mon, 9 Jan 2017 22:51:16 +0000 (23:51 +0100)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Sun, 15 Jan 2017 23:24:07 +0000 (00:24 +0100)
print_latency.cpp
print_latency.h
quicksync_encoder.cpp

index 0b0a1ae483e9bb2ce3ce6df15413942f89870b82..ee9470cc2187a2f39c325ac29def78f7b5b0efac 100644 (file)
@@ -1,4 +1,5 @@
 #include "print_latency.h"
+
 #include "flags.h"
 
 #include <stdio.h>
@@ -8,6 +9,19 @@
 using namespace std;
 using namespace std::chrono;
 
+ReceivedTimestamps find_received_timestamp(const vector<RefCountedFrame> &input_frames)
+{
+       // Find min and max timestamp of all input frames that have a timestamp.
+       steady_clock::time_point min_ts = steady_clock::time_point::max(), max_ts = steady_clock::time_point::min();
+       for (const RefCountedFrame &input_frame : input_frames) {
+               if (input_frame && input_frame->received_timestamp > steady_clock::time_point::min()) {
+                       min_ts = min(min_ts, input_frame->received_timestamp);
+                       max_ts = max(max_ts, input_frame->received_timestamp);
+               }
+       }
+       return { min_ts, max_ts };
+}
+
 void print_latency(const string &header, const ReceivedTimestamps &received_ts, bool is_b_frame, int *frameno)
 {
        if (received_ts.max_ts == steady_clock::time_point::min())
index 9d8a93b0ff47a751826dd44206268fb307b18775..0e880ca1e75273d2018c594c3a08dd77cb8e8cb9 100644 (file)
@@ -7,6 +7,9 @@
 
 #include <chrono>
 #include <string>
+#include <vector>
+
+#include "ref_counted_frame.h"
 
 // Since every output frame is based on multiple input frames, we need
 // more than one start timestamp. For now, we keep just the smallest
@@ -16,6 +19,8 @@ struct ReceivedTimestamps {
        std::chrono::steady_clock::time_point min_ts, max_ts;
 };
 
+ReceivedTimestamps find_received_timestamp(const std::vector<RefCountedFrame> &input_frames);
+
 void print_latency(const std::string &header, const ReceivedTimestamps &received_ts, bool is_b_frame, int *frameno);
 
 #endif  // !defined(_PRINT_LATENCY_H)
index 284b67ac63101d4934d79b50effbcc5d73315a75..749eb63d7056e638f8c8f4ac1d640706532b3d3e 100644 (file)
@@ -1829,19 +1829,6 @@ void memcpy_with_pitch(uint8_t *dst, const uint8_t *src, size_t src_width, size_
        }
 }
 
-ReceivedTimestamps find_received_timestamp(const vector<RefCountedFrame> &input_frames)
-{
-       // Find min and max timestamp of all input frames that have a timestamp.
-       steady_clock::time_point min_ts = steady_clock::time_point::max(), max_ts = steady_clock::time_point::min();
-       for (const RefCountedFrame &input_frame : input_frames) {
-               if (input_frame && input_frame->received_timestamp > steady_clock::time_point::min()) {
-                       min_ts = min(min_ts, input_frame->received_timestamp);
-                       max_ts = max(max_ts, input_frame->received_timestamp);
-               }
-       }
-       return { min_ts, max_ts };
-}
-
 }  // namespace
 
 void QuickSyncEncoderImpl::pass_frame(QuickSyncEncoderImpl::PendingFrame frame, int display_frame_num, int64_t pts, int64_t duration)