From d2c7e856bb7dfbf69e545fdb37839829410abffa Mon Sep 17 00:00:00 2001 From: Jonathan Thomas Date: Sat, 25 Jun 2022 17:39:48 -0500 Subject: [PATCH] Fixing invalid "end frame" calculation for clips (we were accidentally adding `+1`) to the last frame of every clip, causing a repeat of the clip's last frame. For example, if a video had only 10 frames (video_length), timeline would calculate the start_frame as 1, and end_frame as 11, which is incorrect. It should use start_frame as 1, end_frame as 10. --- src/Timeline.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Timeline.cpp b/src/Timeline.cpp index 6a7c4569..a7d9567d 100644 --- a/src/Timeline.cpp +++ b/src/Timeline.cpp @@ -861,8 +861,7 @@ std::shared_ptr Timeline::GetFrame(int64_t requested_frame) for (auto clip : nearby_clips) { long clip_start_position = round(clip->Position() * info.fps.ToDouble()) + 1; - long clip_end_position = round((clip->Position() + clip->Duration()) * info.fps.ToDouble()) + 1; - + long clip_end_position = round((clip->Position() + clip->Duration()) * info.fps.ToDouble()); bool does_clip_intersect = (clip_start_position <= requested_frame && clip_end_position >= requested_frame); // Debug output