Skip to content

Commit

Permalink
Fixes incorrect trim logic while paused
Browse files Browse the repository at this point in the history
Tested by using the trim start and end functions while playing
and while paused and while playing forward and backward.
  • Loading branch information
DavidXenakis committed Jan 16, 2024
1 parent 0da5eb1 commit 90435ce
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 90435ce

Please sign in to comment.