global: implemented rudimentary memory manager to use available system memory

without forcing the OS to page swap
This commit is contained in:
itsmattkc
2020-02-21 14:20:57 +11:00
parent 2e38e7e3fb
commit e74c4c2d1c
6 changed files with 170 additions and 83 deletions
+16 -3
View File
@@ -27,6 +27,8 @@ extern "C" {
#include <libswresample/swresample.h>
}
#include <QAtomicInt>
#include <QTimer>
#include <QVector>
#include "audio/sampleformat.h"
@@ -64,6 +66,9 @@ public:
virtual void Index(const QAtomicInt *cancelled) override;
signals:
void ConsumedMemory();
private:
/**
* @brief Handle an error
@@ -96,9 +101,6 @@ private:
virtual QString GetIndexFilename() override;
void UnconditionalAudioIndex(const QAtomicInt* cancelled);
void UnconditionalVideoIndex(const QAtomicInt* cancelled);
void ValidateVideoIndex(const QAtomicInt* cancelled);
void Seek(int64_t timestamp);
@@ -127,6 +129,17 @@ private:
bool multithreading_;
QTimer clear_timer_;
QAtomicInt allow_clear_event_;
private slots:
void FreeMemory();
void ClearTimerEvent();
void RestartClearTimer();
};
#endif // FFMPEGDECODER_H