Large performance regression fixed by moving mutex further into the Timeline::GetFrame method - only when generating a new frame (allowing cache to actually work freely). Adding mutex back to FFmpegReader::GetFrame. Removing redundant mutex from ReaderBase.h. Adding mutex to all methods that call shrink_to_fit().

This commit is contained in:
Jonathan Thomas
2022-10-11 18:14:36 -05:00
parent 245186f2a0
commit 5f9c4e06d8
5 changed files with 22 additions and 11 deletions

View File

@@ -84,6 +84,9 @@ void FrameMapper::AddField(Field field)
// Clear both the fields & frames lists
void FrameMapper::Clear() {
// Prevent async calls to the following code
const std::lock_guard<std::recursive_mutex> lock(getFrameMutex);
// Clear the fields & frames lists
fields.clear();
fields.shrink_to_fit();
@@ -104,6 +107,9 @@ void FrameMapper::Init()
// Skip initialization
return;
// Prevent async calls to the following code
const std::lock_guard<std::recursive_mutex> lock(getFrameMutex);
// Clear the fields & frames lists
Clear();