Buffer rewinds from backward skips in replays (#5141)

* split event processing to own method

* implement rewind throttling

* don't throttle backward skips from clicks

* use the term 'buffering' instead

* remove initial backup logic; just always buffer shortcut backward skips

* prevent segfault

* turns out you can just reuse the same one-shot timer

* try scaling timeout based on event count

* rewrite timeout calculation code

* fix linker error
This commit is contained in:
RickyRister 2024-11-05 09:45:42 -08:00 committed by GitHub
parent 6652012f4c
commit e43a21866c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 69 additions and 13 deletions

View file

@ -18,6 +18,9 @@ signals:
private:
QTimer *replayTimer;
static constexpr int BASE_REWIND_BUFFERING_TIMEOUT_MS = 180;
static constexpr int MAX_REWIND_BUFFERING_TIMEOUT_MS = 280;
QTimer *rewindBufferingTimer;
QList<int> replayTimeline;
QList<int> histogram;
static const int binLength;
@ -26,7 +29,11 @@ private:
int currentTime;
int currentEvent;
void skipToTime(int newTime);
void skipToTime(int newTime, bool doRewindBuffering);
void handleBackwardsSkip(bool doRewindBuffering);
int calcRewindBufferingTimeout() const;
void processRewind();
void processNewEvents();
private slots:
void replayTimerTimeout();