render: implemented frame pool

Optimization
This commit is contained in:
itsmattkc
2021-04-28 16:17:11 +10:00
parent 2e96b57319
commit 3903f70259
6 changed files with 50 additions and 15 deletions
-1
View File
@@ -455,7 +455,6 @@ void ViewerWidget::UpdateTextureFromNode()
// Check playback queue for a frame
if (IsPlaying()) {
// We still run the playback queue even when FrameExistsAtTime returns false because we might be
// playing backwards and about to start showing frames, so the queue should be prepared for
// that.
+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_;
}