Skip to content

Commit a8f75a5

Browse files
authored
Merge pull request #179 from OpenShot/fixing-cache-performance
Improving cache performance by preventing the cache from getting behind
2 parents 31e9e7b + 4ed7847 commit a8f75a5

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

src/Qt/PlayerPrivate.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ namespace openshot
149149
else
150150
{
151151
// Update cache on which frame was retrieved
152-
videoCache->current_display_frame = video_position;
152+
videoCache->setCurrentFramePosition(video_position);
153153

154154
// return frame from reader
155155
return reader->GetFrame(video_position);

src/Qt/VideoCacheThread.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,12 @@ namespace openshot
102102
// Ignore out of bounds frame exceptions
103103
}
104104

105+
// Is cache position behind current display frame?
106+
if (position < current_display_frame) {
107+
// Jump ahead
108+
position = current_display_frame;
109+
}
110+
105111
// Increment frame number
106112
position++;
107113
}

0 commit comments

Comments
 (0)