]> git.sesse.net Git - nageru/blobdiff - nageru/x264_speed_control.cpp
IWYU-fix nageru/*.cpp.
[nageru] / nageru / x264_speed_control.cpp
index 719cf28d3ef5a47773bd133206a283ba18b1579f..0c7e7e8632b689fd06460cc6dae7486a53f24d95 100644 (file)
@@ -3,15 +3,15 @@
 #include <dlfcn.h>
 #include <math.h>
 #include <stdio.h>
+#include <stdint.h>
 #include <x264.h>
 #include <algorithm>
 #include <chrono>
 #include <cmath>
-#include <ratio>
-#include <type_traits>
 
 #include "flags.h"
-#include "metrics.h"
+#include "shared/metrics.h"
+#include "x264_dynamic.h"
 
 using namespace std;
 using namespace std::chrono;
@@ -19,7 +19,7 @@ using namespace std::chrono;
 #define SC_PRESETS 23
 
 X264SpeedControl::X264SpeedControl(x264_t *x264, float f_speed, int i_buffer_size, float f_buffer_init)
-       : dyn(load_x264_for_bit_depth(global_flags.x264_bit_depth)),
+       : dyn(load_x264_for_bit_depth(global_flags.bit_depth)),
          x264(x264), f_speed(f_speed)
 {
        x264_param_t param;
@@ -208,17 +208,6 @@ void X264SpeedControl::before_frame(float new_buffer_fill, int new_buffer_size,
        stat.max_buffer = max(buffer_fill, stat.max_buffer);
 
        if (buffer_fill >= buffer_size) { // oops, cpu was idle
-               // not really an error, but we'll warn for debugging purposes
-               static int64_t idle_t = 0;
-               static steady_clock::time_point print_interval;
-               static bool first = false;
-               idle_t += buffer_fill - buffer_size;
-               if (first || duration<double>(t - print_interval).count() > 0.1) {
-                       //fprintf(stderr, "speedcontrol idle (%.6f sec)\n", idle_t/1e6);
-                       print_interval = t;
-                       idle_t = 0;
-                       first = false;
-               }
                buffer_fill = buffer_size;
                metric_x264_speedcontrol_buffer_available_seconds = buffer_fill * 1e-6;
                ++metric_x264_speedcontrol_idle_frames;