render: implemented frame pool

Optimization
This commit is contained in:
itsmattkc
2021-04-28 17:31:25 +10:00
parent 2e96b57319
commit 51ccaedc78
8 changed files with 270 additions and 15 deletions
+3 -2
View File
@@ -21,6 +21,7 @@
#include "viewerplaybacktimer.h"
#include <QDateTime>
#include <QtMath>
namespace olive {
@@ -29,14 +30,14 @@ void ViewerPlaybackTimer::Start(const int64_t &start_timestamp, const int &playb
start_msec_ = QDateTime::currentMSecsSinceEpoch();
start_timestamp_ = start_timestamp;
playback_speed_ = playback_speed;
timebase_ = timebase;
timebase_ = timebase * 1000;
}
int64_t ViewerPlaybackTimer::GetTimestampNow() const
{
int64_t real_time = QDateTime::currentMSecsSinceEpoch() - start_msec_;
int64_t frames_since_start = qRound(static_cast<double>(real_time) / (timebase_ * 1000));
int64_t frames_since_start = qFloor(static_cast<double>(real_time) / (timebase_));
return start_timestamp_ + frames_since_start * playback_speed_;
}