Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

test(verify): FFmpeg first-frame shortcut freeze after a jump to the start

Richie McIlroy48aa1267599a
diff --git a/crates/verify/expectations.toml b/crates/verify/expectations.toml
index afa44c666..cf503a589 100644
--- a/crates/verify/expectations.toml
+++ b/crates/verify/expectations.toml
@@ -169,8 +169,14 @@ reason = "On the macos-15 runner (paravirtual VideoToolbox) the wrong-GOP seek a
link = "https://github.com/CapSoftware/Cap/pull/2603"
[[xfail]]
-case = "seek/seek-*/keyframes60/ffmpeg"
+case = "seek/seek-native/keyframes60/ffmpeg"
class = "stale"
platforms = ["linux", "windows"]
-reason = "NEW: FFmpeg decoder seeks near the start show frame 0 (frame 124 at 60 fps shows source 0 instead of 61) and one keyframe seek answers one frame stale (linux runner; the x264 fallback fixture)"
+reason = "NEW: FFmpeg decoder. Off macOS this fixture is libx264 (the AVFoundation encoder is unavailable), so its keyframe set and shuffled request order differ from macOS. Requests 366 (6.1 s), 1, 124 (all 60 fps seeks): 124 shows source frame 0 for 61, the first-frame shortcut bug of seek/seek-gop/home-then-play30/ffmpeg. Request 490 shows 243 for 244: the 2-frame backward lookback tolerance. seek-gop/keyframes60/ffmpeg passes on both. Identical on Linux and Windows, 3 of 3 runs each"
+link = ""
+
+[[xfail]]
+case = "seek/seek-gop/home-then-play30/ffmpeg"
+class = "stale"
+reason = "NEW: FFmpeg decoder freezes on the first frame after a jump to the start. Seek 6.1 s, seek 0, seek 2.0 s and play: 31 of 122 frames show source frame 0 (up to 89 frames stale, about 1 s frozen). A request at grid 0..2 is answered by the first-frame shortcut (ffmpeg.rs, requested_frame <= MAX_FRAME_LOOKBACK_TOLERANCE) without resetting the reader, which stays near 6 s, and last_sent_frame becomes frame 0; the next request is then not 'far forward' of frame 0 (< FRAME_CACHE_SIZE), so no reset happens, the reader vends frames past the request and the answer falls back to last_sent_frame (frame 0) until playback outruns FRAME_CACHE_SIZE. Main decoder on Linux and on Windows without a D3D11 video device; macOS AVAssetReader passes. Minimal: CAP_VERIFY_SEEK_SCRIPT='seek-gop@60:6.1,0.0167,2.0667' (third request shows frame 0 for 61)"
link = ""
diff --git a/crates/verify/tests/seek.rs b/crates/verify/tests/seek.rs
index aaeba017c..ad5fe3b87 100644
--- a/crates/verify/tests/seek.rs
+++ b/crates/verify/tests/seek.rs
@@ -172,6 +172,30 @@ fn keyframe_seeks() {
common::assert_passed(failures);
}
+/// The editor's "jump to start" after watching later in the file, then a
+/// click 2 s in and playback: seek 6.1 s, seek 0, seek 2.0 s and play 4 s.
+#[test]
+fn home_then_play() {
+ let mut failures: Vec<String> = Vec::new();
+ let home = |total: u32, _: &common::Project| {
+ let fps = 30.0;
+ let mut out: Vec<Request> = vec![((6.1 * fps) as u32, true), (0, true)];
+ let start = (2.0 * fps) as u32;
+ out.push((start, true));
+ out.extend((1..=120).map(|k| (start + k, false)));
+ out.retain(|&(f, _)| f < total);
+ out
+ };
+ failures.extend(run(
+ catalog::seek_gop(report::tier()),
+ "home-then-play",
+ 30,
+ no_edit,
+ &home,
+ ));
+ common::assert_passed(failures);
+}
+
/// Scrubbing: seek every 0.25 s forwards, then backwards.
#[test]
fn scrub() {