X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=x264_speed_control.h;h=af4513ea5a037ab596e7a016ed98fee1e1acf73b;hb=21bd3592c1a692463abd321047c2c612f91cc2ad;hp=7add8fdd4c2c2a3c9386d74a0854aa2389bc9e41;hpb=a67460db8ba2c3c50e75866fa85091fbebdc7386;p=nageru diff --git a/x264_speed_control.h b/x264_speed_control.h index 7add8fd..af4513e 100644 --- a/x264_speed_control.h +++ b/x264_speed_control.h @@ -47,6 +47,7 @@ #include #include #include +#include #include extern "C" { @@ -96,16 +97,15 @@ private: void set_buffer_size(int new_buffer_size); int dither_preset(float f); void apply_preset(int new_preset); - int64_t mdate(); // Current time in microseconds. // Not owned by us. x264_t *x264; float f_speed; - // all times are in usec - int64_t timestamp; // when was speedcontrol last invoked - int64_t cpu_time_last_frame = 0; // time spent encoding the previous frame + // all times that are not std::chrono::* are in usec + std::chrono::steady_clock::time_point timestamp; // when was speedcontrol last invoked + std::chrono::steady_clock::duration cpu_time_last_frame{std::chrono::seconds{0}}; // time spent encoding the previous frame int64_t buffer_size; // assumed application-side buffer of frames to be streamed (measured in microseconds), int64_t buffer_fill; // where full = we don't have to hurry int64_t compensation_period; // how quickly we try to return to the target buffer fullness