You've already forked libopenshot
mirror of
https://github.com/OpenShot/libopenshot.git
synced 2026-03-02 08:53:52 -08:00
Fix FFmpeg seek fallback to avoid overshoot frame mismatches. Harden FFmpegReader::CheckSeek() when seek retries are exhausted.
This commit is contained in:
@@ -1511,18 +1511,12 @@ bool FFmpegReader::CheckSeek() {
|
||||
if (seek_count < kSeekRetryMax) {
|
||||
Seek(seeking_frame - (10 * seek_count * seek_count));
|
||||
} else {
|
||||
if (seek_stagnant_count >= kSeekStagnantMax) {
|
||||
// Overshot and no progress: restart from the beginning and walk forward
|
||||
Seek(1);
|
||||
is_seeking = false;
|
||||
seeking_frame = 0;
|
||||
seeking_pts = -1;
|
||||
} else {
|
||||
// Give up retrying and walk forward
|
||||
is_seeking = false;
|
||||
seeking_frame = 0;
|
||||
seeking_pts = -1;
|
||||
}
|
||||
// Retry budget exhausted: always restart from frame 1 and walk forward.
|
||||
// This avoids returning frames from an overshot seek position.
|
||||
Seek(1);
|
||||
is_seeking = false;
|
||||
seeking_frame = 0;
|
||||
seeking_pts = -1;
|
||||
}
|
||||
} else {
|
||||
// SEEK WORKED
|
||||
|
||||
Reference in New Issue
Block a user