Open source Loom alternative. Beautiful, shareable screen recordings.
Rust appcapcossloommacnextjsnextjs15open-sourceossreactrecordrustscreen-capturescreen-recorderscreenshotsolidjstauritauri-apptypescriptvite
fix(verify): keep camera markers readable in editing exports
Richie McIlroy222ecb7a09db
diff --git a/crates/verify/expectations.toml b/crates/verify/expectations.tomlindex bf4e8b119..89ac5bfb1 100644--- a/crates/verify/expectations.toml+++ b/crates/verify/expectations.toml@@ -186,14 +186,6 @@ bound = { count = 1 }reason = "NEW (minor): loading a legacy (output-timed) project drops a caption that ends exactly at the timeline end: synchronize_captions maps each end through source_start + (end - start) / timescale, which rounds just below the timeline end after a clip transition (clips 41/15 s and 82/15 s, 0.2 s transition: 7.9999999 < 8.0), so the end does not map and the whole caption is discarded"link = ""-[[xfail]]-case = "editing/export/basic/seed-23"-class = "future"-platforms = ["linux"]-bound = { camera-frames = 1, delta = 8, frame = [8, 8] }-reason = "NEW: Linux only (software renderer): in seed 23's 3 s same-clip cross-fade, output frame 8 shows incoming camera source frame 84 instead of 76. The FFmpeg decoder answers every camera request with the requested frame (traced: request 76 read 76, run 38997099068, identical on macOS), so a later camera frame reaches the renderer's shared camera layer, which draws the outgoing and incoming sides in turn. Before #2661 the shared decoder made output frames 7 to 12 up to 70 frames stale and hid it. Deterministic on Linux; macOS and Windows pass"-link = ""-[[xfail]]case = "playback/basic/cuts-speeds-reorder/realtime30-from25/avf"class = "stale"diff --git a/crates/verify/tests/captions.rs b/crates/verify/tests/captions.rsindex 8d34a8e0b..d1f3d72f8 100644--- a/crates/verify/tests/captions.rs+++ b/crates/verify/tests/captions.rs@@ -1450,6 +1450,7 @@ fn render_export(out: &Path,) -> Result<Vec<CaptionPixels>, String> {let run = common::ExportRun {+ custom_bpp: None,fps: RENDER_FPS,resolution: RENDER_RES,format: common::Format::Mp4,diff --git a/crates/verify/tests/codec.rs b/crates/verify/tests/codec.rsindex 4fa8ae310..d2efa9de0 100644--- a/crates/verify/tests/codec.rs+++ b/crates/verify/tests/codec.rs@@ -274,6 +274,46 @@ fn damaged_codes_read_as_unreadable_never_as_another_frame() {assert!(hits > 0);}+#[test]+fn camera_crossfade_oracle_detects_the_wrong_incoming_frame_after_encode() {+ let dir = tempfile::tempdir().unwrap();+ let frames: Vec<_> = [76, 84]+ .into_iter()+ .map(|incoming| {+ let mut outgoing = composite(8, 8, 320, 180, false);+ let incoming = composite(8, incoming, 320, 180, false);+ for (a, b) in outgoing.data.iter_mut().zip(incoming.data) {+ *a = (f64::from(*a) * 0.8 + f64::from(b) * 0.2).round() as u8;+ }+ outgoing+ })+ .collect();+ let pictures = encode_decode(&frames, VideoCodec::H264, 1_728_000, dir.path()).unwrap();+ assert_eq!(pictures.len(), 2);+ let expected = vec![+ StreamExpectation::Blend {+ outgoing: (0, vec![8]),+ incoming: (0, vec![76]),+ progress: 0.2,+ };+ 2+ ];+ let observed: Vec<_> = pictures+ .iter()+ .zip(&expected)+ .map(|(picture, expectation)| {+ oracle::read_expecting(&picture.view(), StreamKind::Camera, expectation)+ })+ .collect();+ let report = oracle::check_stream(StreamKind::Camera, &expected, &observed, 30);+ assert_eq!(report.mismatches.len(), 1, "{report:?}");+ assert_eq!(report.ahead, 1);+ assert_eq!(report.max_ahead, 8);+ assert_eq!(report.mismatches[0].output_frame, 1);+ assert_eq!(report.mismatches[0].expected, Some((0, 76)));+ assert_eq!(report.mismatches[0].observed, Some((0, 84)));+}+#[test]fn sequence_oracle_flags_wrong_duplicated_and_missing_frames_after_encode() {let dir = tempfile::tempdir().unwrap();diff --git a/crates/verify/tests/common/mod.rs b/crates/verify/tests/common/mod.rsindex e6ca89c7e..bfbc69c6b 100644--- a/crates/verify/tests/common/mod.rs+++ b/crates/verify/tests/common/mod.rs@@ -265,6 +265,7 @@ pub async fn probe_decoders(case: &mut Case, project: &Project, decoder: Decoder}pub struct ExportRun {+ pub custom_bpp: Option<f32>,pub fps: u32,pub resolution: (u32, u32),pub format: Format,@@ -292,7 +293,7 @@ pub async fn export(fps: run.fps,resolution_base,compression: cap_export::mp4::ExportCompression::Social,- custom_bpp: None,+ custom_bpp: run.custom_bpp,force_ffmpeg_decoder: force,optimize_filesize: false,}diff --git a/crates/verify/tests/editing.rs b/crates/verify/tests/editing.rsindex 63090c7f0..c55158257 100644--- a/crates/verify/tests/editing.rs+++ b/crates/verify/tests/editing.rs@@ -31,6 +31,10 @@ use edits::{Mapping, Op, OpMix, TimeModel};const TOLERANCE: f64 = 1e-9;const EDGE_EPSILON: f64 = 1e-6;+// At 320x180, lossy compression can turn a camera crossfade's tiny marker+// cells into a different valid index. Keep this timing oracle's signal readable.+const MARKER_EXPORT_BPP: f32 = 1.0;+/// Output times to probe: a 1/60 s grid, random times and both sides of/// every edge.fn probe_times(model: &TimeModel, rng: &mut Rng) -> Vec<f64> {@@ -348,6 +352,7 @@ fn export_cases(spec: cap_verify::fixture::FixtureSpec, seeds: u64) -> Vec<Strinlet model = project.model(&config);let dir = common::scratch_dir(&id);let run = ExportRun {+ custom_bpp: Some(MARKER_EXPORT_BPP),fps,resolution: (320, 180),format: Format::Mp4,@@ -412,6 +417,7 @@ fn same_clip_transition_export() {let mut case = Case::new(&id);let dir = common::scratch_dir(&id);let run = ExportRun {+ custom_bpp: Some(MARKER_EXPORT_BPP),fps,resolution: (320, 180),format: Format::Mp4,@@ -456,6 +462,7 @@ fn hold_past_end_export() {let mut case = Case::new(id);let dir = common::scratch_dir(id);let run = ExportRun {+ custom_bpp: Some(MARKER_EXPORT_BPP),fps,resolution: (320, 180),format: Format::Mp4,diff --git a/crates/verify/tests/export.rs b/crates/verify/tests/export.rsindex cd40593b4..46d062216 100644--- a/crates/verify/tests/export.rs+++ b/crates/verify/tests/export.rs@@ -78,6 +78,7 @@ fn run_project(Format::Mp4 => "mp4",};let run = ExportRun {+ custom_bpp: None,fps,resolution,format,@@ -1039,6 +1040,7 @@ fn colour() {));let dir = common::scratch_dir(&id);let run = ExportRun {+ custom_bpp: None,fps: 30,resolution: RES,format: Format::Mp4,@@ -1158,6 +1160,7 @@ fn crop() {let mut case = Case::new(&id);let dir = common::scratch_dir(&id);let run = ExportRun {+ custom_bpp: None,fps: 30,resolution: RES,format: Format::Mp4,@@ -1286,6 +1289,7 @@ fn recorded_studio_audio() {let mut case = Case::new(&id);let dir = common::scratch_dir(&id);let run = ExportRun {+ custom_bpp: None,fps: 30,resolution: RES,format: Format::Mp4,