X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=nageru%2Fqueue_length_policy.h;h=d5a77cc42b7121f2318cc948465def0d8715a838;hb=3256213f93385cc56281c616e0347ff5fa2b70ac;hp=27259b4c54bb517c83557d277517134f3e301868;hpb=c4497a099d6a01ff2eedb483c2589ef70e7c657c;p=nageru diff --git a/nageru/queue_length_policy.h b/nageru/queue_length_policy.h index 27259b4..d5a77cc 100644 --- a/nageru/queue_length_policy.h +++ b/nageru/queue_length_policy.h @@ -2,6 +2,9 @@ #define _QUEUE_LENGTH_POLICY_H 1 #include +#include +#include +#include #include #include #include @@ -35,6 +38,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 +57,7 @@ private: std::deque::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 metric_input_underestimated_jitter_frames{0}; @@ -88,7 +93,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,