Break out of cache loop if playback speed changes during caching. Move getFrame() below pause code, to prevent accidental incrementing video_position.

This commit is contained in:
Jonathan Thomas
2022-02-01 15:33:32 -06:00
parent 87a6aa9b39
commit f70ca4b877
2 changed files with 8 additions and 3 deletions

View File

@@ -79,6 +79,7 @@ namespace openshot
while (!threadShouldExit() && is_playing) {
// Calculate on-screen time for a single frame
const auto frame_duration = double_micro_sec(1000000.0 / reader->info.fps.ToDouble());
int current_speed = speed;
// Calculate bytes per frame. If we have a reference openshot::Frame, use that instead (the preview
// window can be smaller, can thus reduce the bytes per frame)
@@ -141,6 +142,10 @@ namespace openshot
break;
}
}
// Check if playback speed changed (if so, break out of cache loop)
if (current_speed != speed) {
break;
}
}
// Update current display frame