Skip to content

Commit

Permalink
Fix incorrect trim logic while paused (#54)
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidXenakis committed Jan 17, 2024
1 parent 0da5eb1 commit 7fc2d67
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions replay-source.c
Original file line number Diff line number Diff line change
Expand Up @@ -1801,7 +1801,9 @@ static void replay_trim_front_hotkey(void *data, obs_hotkey_id id,
if (!pressed)
return;

const uint64_t timestamp = obs_get_video_frame_time();
const uint64_t timestamp = c->pause_timestamp == 0
? obs_get_video_frame_time()
: c->pause_timestamp;
int64_t duration = timestamp - c->start_timestamp;
if (c->speed_percent != 100.0f) {
duration = (int64_t)(duration * c->speed_percent / 100.0);
Expand Down Expand Up @@ -1833,7 +1835,9 @@ static void replay_trim_end_hotkey(void *data, obs_hotkey_id id,

if (!pressed)
return;
const uint64_t timestamp = obs_get_video_frame_time();

const uint64_t timestamp = c->pause_timestamp == 0
? obs_get_video_frame_time() : c->pause_timestamp;
if (timestamp > c->start_timestamp) {
int64_t duration = timestamp - c->start_timestamp;
if (c->speed_percent != 100.0f) {
Expand Down

0 comments on commit 7fc2d67

Please sign in to comment.