]> git.sesse.net Git - nageru/blobdiff - nageru/queue_length_policy.h
IWYU-fix nageru/*.h.
[nageru] / nageru / queue_length_policy.h
index 27259b4c54bb517c83557d277517134f3e301868..9a52fc13b17cb9639e669e463ef8a6a745006827 100644 (file)
@@ -1,7 +1,13 @@
 #ifndef _QUEUE_LENGTH_POLICY_H
 #define _QUEUE_LENGTH_POLICY_H 1
 
+#include <stddef.h>
+#include <stdint.h>
+
 #include <atomic>
+#include <chrono>
+#include <deque>
+#include <set>
 #include <string>
 #include <utility>
 #include <vector>
@@ -35,6 +41,7 @@ public:
        void clear() {
                history.clear();
                orders.clear();
+               expected_timestamp = std::chrono::steady_clock::time_point::min();
        }
        void frame_arrived(std::chrono::steady_clock::time_point now, int64_t frame_duration, size_t dropped_frames);
        std::chrono::steady_clock::time_point get_expected_next_frame() const { return expected_timestamp; }
@@ -53,6 +60,7 @@ private:
        std::deque<std::multiset<double>::iterator> history;
 
        std::chrono::steady_clock::time_point expected_timestamp = std::chrono::steady_clock::time_point::min();
+       int64_t last_duration = 0;
 
        // Metrics. There are no direct summaries for jitter, since we already have latency summaries.
        std::atomic<int64_t> metric_input_underestimated_jitter_frames{0};
@@ -88,7 +96,7 @@ public:
        // Call after picking out a frame, so 0 means starvation.
        // Note that the policy has no memory; everything is given in as parameters.
        void update_policy(std::chrono::steady_clock::time_point now,
-                          std::chrono::steady_clock::time_point expected_next_frame,
+                          std::chrono::steady_clock::time_point expected_next_input_frame,
                           int64_t input_frame_duration,
                           int64_t master_frame_duration,
                           double max_input_card_jitter_seconds,