diff options
Diffstat (limited to 'src/main.cpp')
-rw-r--r-- | src/main.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/main.cpp b/src/main.cpp index 3f1b68c..d230e47 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -3782,9 +3782,11 @@ int main(int argc, char **argv) { const double time_at_frame_end = clock_get_monotonic_seconds() - paused_time_offset; const double time_elapsed_total = time_at_frame_end - record_start_time; - //const int64_t frames_elapsed = std::round(time_elapsed_total / target_fps); - const double time_at_next_frame = (video_pts_counter + 1) * target_fps; - const double time_to_next_frame = time_at_next_frame - time_elapsed_total; + const int64_t frames_elapsed = (int64_t)(time_elapsed_total / target_fps); + const double time_at_next_frame = (frames_elapsed + 1) * target_fps; + double time_to_next_frame = time_at_next_frame - time_elapsed_total; + if(time_to_next_frame > target_fps*1.1) + time_to_next_frame = target_fps; //const double frame_end = clock_get_monotonic_seconds(); //const double frame_time = frame_end - frame_start; |