Merge pull request #688 from ferdnyc/unbreak-timeline-cache

Revert final_cache size breakage to unbreak OpenShot caching
This commit is contained in:
Frank Dana
2021-09-23 08:51:51 -04:00
committed by GitHub

View File

@@ -80,11 +80,12 @@ Timeline::Timeline(int width, int height, Fraction fps, int sample_rate, int cha
info.acodec = "openshot::timeline";
info.vcodec = "openshot::timeline";
// Init cache
final_cache = new CacheMemory();
// Init max image size
SetMaxSize(info.width, info.height);
// Init cache
final_cache = new CacheMemory();
final_cache->SetMaxBytesFromInfo(max_concurrent_frames * 4, info.width, info.height, info.sample_rate, info.channels);
}
// Delegating constructor that copies parameters from a provided ReaderInfo
@@ -95,7 +96,7 @@ Timeline::Timeline(const ReaderInfo info) :
// Constructor for the timeline (which loads a JSON structure from a file path, and initializes a timeline)
Timeline::Timeline(const std::string& projectPath, bool convert_absolute_paths) :
is_open(false), auto_map_clips(true), managed_cache(true), path(projectPath),
max_concurrent_frames(OPEN_MP_NUM_PROCESSORS) {
max_concurrent_frames(OPEN_MP_NUM_PROCESSORS) {
// Create CrashHandler and Attach (incase of errors)
CrashHandler::Instance();
@@ -212,11 +213,12 @@ Timeline::Timeline(const std::string& projectPath, bool convert_absolute_paths)
info.has_video = true;
info.has_audio = true;
// Init cache
final_cache = new CacheMemory();
// Init max image size
SetMaxSize(info.width, info.height);
// Init cache
final_cache = new CacheMemory();
final_cache->SetMaxBytesFromInfo(max_concurrent_frames * 4, info.width, info.height, info.sample_rate, info.channels);
}
Timeline::~Timeline() {
@@ -1064,7 +1066,7 @@ void Timeline::SetJsonValue(const Json::Value root) {
// on it's parent timeline. Setting the parent timeline of the clip here
// allows attaching it to an object when exporting the project (because)
// the exporter script initializes the clip and it's effects
// before setting it's parent timeline.
// before setting its parent timeline.
c->ParentTimeline(this);
// Load Json into Clip
@@ -1530,7 +1532,4 @@ void Timeline::SetMaxSize(int width, int height) {
// Update preview settings
preview_width = display_ratio_size.width();
preview_height = display_ratio_size.height();
// Update timeline cache size
final_cache->SetMaxBytesFromInfo(max_concurrent_frames * 4, preview_width, preview_height, info.sample_rate, info.channels);
}
}