aboutsummaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2024-09-21 16:38:15 +0200
committerdec05eba <dec05eba@protonmail.com>2024-09-21 16:38:15 +0200
commit95e1971f8fc2b9f1814a80ffa19d17fc4eda9e47 (patch)
treeb2a288c1aa46be23aa91f304cc55f8fc5c5909f7 /src/main.cpp
parentfb707aee6f61cef84cc15a3a00f46e7bf52f3ceb (diff)
Fix first frame is black
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/main.cpp b/src/main.cpp
index ef53935..7c66bd1 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -3158,7 +3158,7 @@ int main(int argc, char **argv) {
}
double fps_start_time = clock_get_monotonic_seconds();
- double frame_timer_start = fps_start_time - target_fps; // We want to capture the first frame immediately
+ double frame_timer_start = fps_start_time;
int fps_counter = 0;
int damage_fps_counter = 0;
@@ -3446,11 +3446,11 @@ int main(int argc, char **argv) {
}
double frame_time_overflow = frame_timer_elapsed - target_fps;
- if (frame_time_overflow >= 0.0 && damaged) {
+ if ((frame_time_overflow >= 0.0 || video_pts_counter == 0) && damaged) {
gsr_damage_clear(&damage);
if(capture->clear_damage)
capture->clear_damage(capture);
- frame_time_overflow = std::min(frame_time_overflow, target_fps);
+ frame_time_overflow = std::min(std::max(0.0, frame_time_overflow), target_fps);
frame_timer_start = time_now - frame_time_overflow;
const double this_video_frame_time = clock_get_monotonic_seconds() - paused_time_offset;