ffmpegdecoder/memorymanager: fixed race condition in garbage collection

This commit is contained in:
itsmattkc
2020-02-21 23:15:09 +11:00
parent b0c9711974
commit 547990b920
4 changed files with 14 additions and 24 deletions
+5 -1
View File
@@ -39,11 +39,15 @@ bool MemoryManager::ShouldFreeMemory()
return (GetAvailableMemory() < minimum_available_memory_);
}
void MemoryManager::ConsumedMemory()
bool MemoryManager::RegisterMemory()
{
if (ShouldFreeMemory()) {
emit FreeMemory();
return true;
}
return false;
}
uint64_t MemoryManager::GetAvailableMemory()
+1 -2
View File
@@ -15,8 +15,7 @@ public:
static bool ShouldFreeMemory();
public slots:
void ConsumedMemory();
bool RegisterMemory();
signals:
void FreeMemory();