Skip to content

Commit

Permalink
Account for the start time
Browse files Browse the repository at this point in the history
  • Loading branch information
darbyjohnston committed Sep 18, 2024
1 parent 3be9a3d commit 108cc69
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions lib/tlTimeline/Player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -708,8 +708,8 @@ namespace tl
t -= frame * p.speed->get() / timelineSpeed;
}
const otime::RationalTime currentTime = p.loopPlayback(
otime::RationalTime(t, rate).rescaled_to(p.speed->get()).
floor());
p.timeline->getTimeRange().start_time() +
otime::RationalTime(t, rate).rescaled_to(p.speed->get()).floor());
//const double currentTimeDiff = abs(currentTime.value() - p.currentTime->get().value());
if (p.currentTime->setIfChanged(currentTime))
{
Expand Down
2 changes: 1 addition & 1 deletion lib/tlTimeline/PlayerAudio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ namespace tl
void Player::Private::audioReset(const otime::RationalTime& time)
{
audioMutex.reset = true;
audioMutex.start = time.rescaled_to(ioInfo.audio.sampleRate).value();
audioMutex.start = (time - timeline->getTimeRange().start_time()).rescaled_to(ioInfo.audio.sampleRate).value();
audioMutex.frame = 0;
}

Expand Down
2 changes: 1 addition & 1 deletion lib/tlTimeline/PlayerPrivate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -533,7 +533,7 @@ namespace tl
void Player::Private::playbackReset(const otime::RationalTime& time)
{
noAudio.playbackTimer = std::chrono::steady_clock::now();
noAudio.start = time.rescaled_to(ioInfo.videoTime.duration().rate()).value();
noAudio.start = (time - timeline->getTimeRange().start_time()).rescaled_to(ioInfo.videoTime.duration().rate()).value();
}

void Player::Private::log(const std::shared_ptr<system::Context>& context)
Expand Down

0 comments on commit 108cc69

Please sign in to comment.