fix: keep the displayed frame during frame stepping

This commit is contained in:
2026-10-10 18:12:25 +02:00
parent a99b0c1168
commit 2bb7d9b4ee
4 changed files with 14 additions and 11 deletions
+4 -3
View File
@@ -269,9 +269,9 @@ struct Player {
check(avcodec_open2(track.codec, decoder, nullptr), "Opening decoder");
}
void resetTimeline(double target) {
void resetTimeline(double target, bool clearVideo = true) {
output.pause();
output.reset();
output.reset(clearVideo);
for (auto &track : tracks) {
if (!track.codec) continue;
avcodec_flush_buffers(track.codec);
@@ -425,7 +425,8 @@ struct Player {
output.pause();
check(av_seek_frame(format, tracks[1].index, timestamp, AVSEEK_FLAG_BACKWARD),
"Seeking video keyframe");
resetTimeline(target);
// Decoder preroll must not blank the last presented frame between steps.
resetTimeline(target, false);
status = PLAYER_PAUSED;
}