Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

feat(verify): fixtures recorded through the real recording pipeline (multi-segment Studio)

Richie McIlroyc4b547a927b2
diff --git a/crates/verify/src/catalog.rs b/crates/verify/src/catalog.rs
index f258844d0..054847109 100644
--- a/crates/verify/src/catalog.rs
+++ b/crates/verify/src/catalog.rs
@@ -228,3 +228,44 @@ pub fn backward_hold(_tier: Tier) -> FixtureSpec {
}],
}
}
+
+/// Recorded through the real pipeline: two recording segments (pause and
+/// resume), the first with a jittery camera that is the last device to
+/// start, a static-screen hold, a mic that starts late and loopback-style
+/// system audio; the second screen and mic only. (A camera that starts
+/// before the mic is covered by `early_camera`.)
+pub fn recorded_studio(_tier: Tier) -> crate::pipeline::RecordedSpec {
+ use crate::pipeline::{Delivery, RecordedSegment, RecordedSpec, RecordedVideo};
+ let screen = |delivery| RecordedVideo {
+ width: SCREEN_W,
+ height: SCREEN_H,
+ fps: 30,
+ delivery,
+ start_delay: 0.0,
+ };
+ RecordedSpec {
+ name: "studio".into(),
+ segments: vec![
+ RecordedSegment {
+ duration: 6.0,
+ screen: screen(Delivery::Holds(vec![(2.0, 1.5)])),
+ camera: Some(RecordedVideo {
+ width: CAMERA_W,
+ height: CAMERA_H,
+ fps: 30,
+ delivery: Delivery::Jittery { seed: 0x5EED_0003 },
+ start_delay: 0.3,
+ }),
+ mic_delay: Some(0.15),
+ system_audio: true,
+ },
+ RecordedSegment {
+ duration: 4.0,
+ screen: screen(Delivery::Steady),
+ camera: None,
+ mic_delay: Some(0.1),
+ system_audio: false,
+ },
+ ],
+ }
+}
diff --git a/crates/verify/src/fixture.rs b/crates/verify/src/fixture.rs
index 6198121e2..9c18df40c 100644
--- a/crates/verify/src/fixture.rs
+++ b/crates/verify/src/fixture.rs
@@ -208,16 +208,20 @@ pub struct FixtureSpec {
pub segments: Vec<SegmentSpec>,
}
+/// Stable cache key over a spec and the generator version.
+pub fn cache_key(name: &str, spec: &impl Serialize) -> String {
+ let json = serde_json::to_string(spec).unwrap_or_default();
+ let mut hash: u64 = 0xcbf2_9ce4_8422_2325 ^ u64::from(GENERATOR_VERSION);
+ for byte in json.bytes() {
+ hash ^= u64::from(byte);
+ hash = hash.wrapping_mul(0x0100_0000_01b3);
+ }
+ format!("{name}-{hash:016x}")
+}
+
impl FixtureSpec {
- /// Stable key over the spec and generator version, for caching.
pub fn cache_key(&self) -> String {
- let json = serde_json::to_string(self).unwrap_or_default();
- let mut hash: u64 = 0xcbf2_9ce4_8422_2325 ^ u64::from(GENERATOR_VERSION);
- for byte in json.bytes() {
- hash ^= u64::from(byte);
- hash = hash.wrapping_mul(0x0100_0000_01b3);
- }
- format!("{}-{hash:016x}", self.name)
+ cache_key(&self.name, self)
}
}
@@ -453,10 +457,17 @@ pub fn fixture_root() -> PathBuf {
pub fn ensure_fixture(
spec: &FixtureSpec,
generate: impl FnOnce(&FixtureSpec, &Path) -> anyhow::Result<()>,
+) -> anyhow::Result<PathBuf> {
+ ensure_fixture_keyed(spec.cache_key(), |dir| generate(spec, dir))
+}
+
+/// [`ensure_fixture`] for any generator, keyed by `key`.
+pub fn ensure_fixture_keyed(
+ key: String,
+ generate: impl FnOnce(&Path) -> anyhow::Result<()>,
) -> anyhow::Result<PathBuf> {
let root = fixture_root();
std::fs::create_dir_all(&root)?;
- let key = spec.cache_key();
let dir = root.join(format!("{key}.cap"));
let done = root.join(format!("{key}.complete"));
if done.exists() && dir.exists() {
@@ -473,7 +484,7 @@ pub fn ensure_fixture(
std::process::id(),
NEXT.fetch_add(1, std::sync::atomic::Ordering::Relaxed)
));
- generate(spec, &staging)?;
+ generate(&staging)?;
// Paths inside recording-meta.json are relative, so the staged project
// stays valid after the rename.
if dir.exists() {
diff --git a/crates/verify/src/lib.rs b/crates/verify/src/lib.rs
index 69ad33ae4..3531ceb1b 100644
--- a/crates/verify/src/lib.rs
+++ b/crates/verify/src/lib.rs
@@ -9,5 +9,6 @@ pub mod fixture_avf;
pub mod media;
pub mod model;
pub mod oracle;
+pub mod pipeline;
pub mod report;
pub mod video_code;
diff --git a/crates/verify/src/pipeline.rs b/crates/verify/src/pipeline.rs
new file mode 100644
index 000000000..f95905a2d
--- /dev/null
+++ b/crates/verify/src/pipeline.rs
@@ -0,0 +1,421 @@
+//! Fixtures recorded through the real recording pipeline.
+//!
+//! Synthetic sources (marker frames, marker audio) are fed through the same
+//! channel sources the sync matrix uses into `OutputPipeline` with the
+//! product's muxers and encoders (`Mp4Muxer` for screen and camera,
+//! `OggMuxer` for microphone and system audio). Frames are emitted in real
+//! time because the pipeline pins video timestamps to the wall clock, so a
+//! fixture costs its duration; keep them short. The timing that lands in
+//! the files is whatever the pipeline produced: tests read the truth back
+//! from the files ([`crate::fixture::SourceTruth`]), never from the spec.
+
+use std::{path::Path, time::Duration};
+
+use anyhow::{Context, anyhow};
+use cap_media_info::{AudioInfo, RawVideoFormat, Sample, Type, VideoInfo};
+use cap_project::{AudioMeta, MultipleSegment, VideoMeta};
+use cap_recording::{
+ AudioFrame, ChannelAudioSource, ChannelAudioSourceConfig, ChannelVideoSource,
+ ChannelVideoSourceConfig, OutputPipeline,
+ ffmpeg::{FFmpegVideoFrame, Mp4Muxer, OggMuxer},
+};
+use cap_timestamp::{Timestamp, Timestamps};
+use relative_path::RelativePathBuf;
+use serde::{Deserialize, Serialize};
+
+use crate::{
+ audio_code::{self, AudioSource},
+ fixture::{Rng, segment_dir, write_project_files},
+ video_code::{self, FrameMarker, PixelOrder, StreamKind},
+};
+
+const AUDIO_RATE: u32 = 48_000;
+const AUDIO_CHUNK_SECS: f64 = 0.02;
+
+/// How a synthetic video device delivers frames.
+#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
+pub enum Delivery {
+ /// Every slot of the nominal rate.
+ Steady,
+ /// No frames inside the (start, length) windows: a static screen.
+ Holds(Vec<(f64, f64)>),
+ /// Slots skipped at random (1..=3 slots apart), like a camera in low
+ /// light.
+ Jittery { seed: u64 },
+}
+
+impl Delivery {
+ fn slots(&self, fps: u32, duration: f64) -> Vec<u32> {
+ let end = (duration * f64::from(fps)) as u32;
+ match self {
+ Delivery::Steady => (0..end).collect(),
+ Delivery::Holds(holds) => (0..end)
+ .filter(|&k| {
+ let t = f64::from(k) / f64::from(fps);
+ !holds.iter().any(|&(s, l)| t > s && t < s + l)
+ })
+ .collect(),
+ Delivery::Jittery { seed } => {
+ let mut rng = Rng::new(*seed);
+ let mut out = Vec::new();
+ let mut k = 0;
+ while k < end {
+ out.push(k);
+ k += rng.range(1, 3) as u32;
+ }
+ out
+ }
+ }
+ }
+}
+
+#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
+pub struct RecordedVideo {
+ pub width: u32,
+ pub height: u32,
+ pub fps: u32,
+ pub delivery: Delivery,
+ /// Seconds after the segment starts before the device delivers.
+ pub start_delay: f64,
+}
+
+#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
+pub struct RecordedSegment {
+ pub duration: f64,
+ pub screen: RecordedVideo,
+ pub camera: Option<RecordedVideo>,
+ /// Microphone starting this many seconds in (continuous delivery).
+ pub mic_delay: Option<f64>,
+ /// System audio delivered loopback-style (packets only while a marker
+ /// plays; the recorder synthesises the silence between).
+ pub system_audio: bool,
+}
+
+#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
+pub struct RecordedSpec {
+ pub name: String,
+ pub segments: Vec<RecordedSegment>,
+}
+
+impl RecordedSpec {
+ /// Key for the fixture cache.
+ pub fn cache_key(&self) -> String {
+ crate::fixture::cache_key(&self.name, self)
+ }
+}
+
+fn bgra_frame(marker: FrameMarker, width: u32, height: u32) -> ffmpeg::frame::Video {
+ let mut frame = ffmpeg::frame::Video::new(ffmpeg::format::Pixel::BGRA, width, height);
+ let stride = frame.stride(0);
+ video_code::draw_marker(
+ marker,
+ frame.data_mut(0),
+ width as usize,
+ height as usize,
+ stride,
+ PixelOrder::Bgra,
+ );
+ frame
+}
+
+/// Marker track for a whole segment, mono, sample 0 = segment start.
+fn marker_track(source: AudioSource, duration: f64) -> Vec<f32> {
+ let mut mono = vec![0.0f32; (duration * f64::from(AUDIO_RATE)) as usize];
+ let schedule = audio_code::standard_schedule(source, 0.1, duration - 0.1, 0.5);
+ audio_code::render_markers(
+ &mut mono,
+ AUDIO_RATE,
+ source,
+ &schedule,
+ audio_code::DEFAULT_AMPLITUDE,
+ );
+ mono
+}
+
+fn audio_chunk(track: &[f32], chunk_t: f64, info: &AudioInfo) -> ffmpeg::frame::Audio {
+ let frames = (f64::from(AUDIO_RATE) * AUDIO_CHUNK_SECS) as usize;
+ let mut frame = ffmpeg::frame::Audio::new(
+ ffmpeg::format::Sample::F32(ffmpeg::format::sample::Type::Packed),
+ frames,
+ info.channel_layout(),
+ );
+ frame.set_rate(AUDIO_RATE);
+ let start = (chunk_t * f64::from(AUDIO_RATE)).round() as usize;
+ let channels = usize::from(info.channels as u16);
+ let data = frame.data_mut(0);
+ for (i, sample) in data.chunks_exact_mut(4 * channels).enumerate() {
+ let v = track.get(start + i).copied().unwrap_or(0.0);
+ for ch in sample.chunks_exact_mut(4) {
+ ch.copy_from_slice(&v.to_le_bytes());
+ }
+ }
+ frame
+}
+
+struct VideoLeg {
+ pipeline: OutputPipeline,
+ emit: tokio::task::JoinHandle<()>,
+ rel: RelativePathBuf,
+ fps: u32,
+}
+
+async fn video_leg(
+ dir: &Path,
+ rel: RelativePathBuf,
+ kind: StreamKind,
+ segment: u8,
+ video: &RecordedVideo,
+ duration: f64,
+ timestamps: Timestamps,
+) -> anyhow::Result<VideoLeg> {
+ let info = VideoInfo::from_raw(RawVideoFormat::Bgra, video.width, video.height, video.fps);
+ let (tx, rx) = flume::bounded::<FFmpegVideoFrame>(32);
+ let base = timestamps.instant();
+ let slots = video
+ .delivery
+ .slots(video.fps, duration - video.start_delay);
+ let (fps, width, height, delay) = (video.fps, video.width, video.height, video.start_delay);
+ let emit = tokio::spawn(async move {
+ for slot in slots {
+ let t = delay + f64::from(slot) / f64::from(fps);
+ let at = base + Duration::from_secs_f64(t);
+ tokio::time::sleep_until(at.into()).await;
+ let frame = FFmpegVideoFrame {
+ inner: bgra_frame(FrameMarker::new(kind, segment, slot), width, height),
+ timestamp: Timestamp::Instant(at),
+ };
+ if tx.send_async(frame).await.is_err() {
+ break;
+ }
+ }
+ });
+ let pipeline = OutputPipeline::builder(dir.join(rel.as_str()))
+ .with_video::<ChannelVideoSource<FFmpegVideoFrame>>(ChannelVideoSourceConfig::new(info, rx))
+ .with_timestamps(timestamps)
+ .build::<Mp4Muxer>(())
+ .await
+ .map_err(|e| anyhow!("{kind:?} pipeline: {e}"))?;
+ Ok(VideoLeg {
+ pipeline,
+ emit,
+ rel,
+ fps: video.fps,
+ })
+}
+
+type AudioEmit = tokio::task::JoinHandle<futures::channel::mpsc::Sender<AudioFrame>>;
+
+async fn record_segment(
+ dir: &Path,
+ index: usize,
+ spec: &RecordedSegment,
+) -> anyhow::Result<MultipleSegment> {
+ let seg = segment_dir(index);
+ std::fs::create_dir_all(dir.join(&seg))?;
+ let rel = |file: &str| RelativePathBuf::from(format!("{seg}/{file}"));
+ let timestamps = Timestamps::now();
+ let base = timestamps.instant();
+
+ let screen = video_leg(
+ dir,
+ rel("display.mp4"),
+ StreamKind::Screen,
+ index as u8,
+ &spec.screen,
+ spec.duration,
+ timestamps,
+ )
+ .await?;
+ let camera = match &spec.camera {
+ Some(camera) => Some(
+ video_leg(
+ dir,
+ rel("camera.mp4"),
+ StreamKind::Camera,
+ index as u8,
+ camera,
+ spec.duration,
+ timestamps,
+ )
+ .await?,
+ ),
+ None => None,
+ };
+
+ let mono_info = AudioInfo::new(Sample::F32(Type::Packed), AUDIO_RATE, 1)
+ .map_err(|e| anyhow!("audio info: {e:?}"))?;
+ let stereo_info = AudioInfo::new(Sample::F32(Type::Packed), AUDIO_RATE, 2)
+ .map_err(|e| anyhow!("audio info: {e:?}"))?;
+
+ let mut mic: Option<(OutputPipeline, AudioEmit, RelativePathBuf)> = None;
+ if let Some(delay) = spec.mic_delay {
+ let track = marker_track(AudioSource::Mic, spec.duration);
+ let (mut tx, rx) = futures::channel::mpsc::channel::<AudioFrame>(32);
+ let duration = spec.duration;
+ let emit = tokio::spawn(async move {
+ use futures::SinkExt;
+ let first = (delay / AUDIO_CHUNK_SECS).ceil() as usize;
+ let last = (duration / AUDIO_CHUNK_SECS) as usize;
+ for k in first..last {
+ let t = k as f64 * AUDIO_CHUNK_SECS;
+ let at = base + Duration::from_secs_f64(t);
+ tokio::time::sleep_until(at.into()).await;
+ let frame =
+ AudioFrame::new(audio_chunk(&track, t, &mono_info), Timestamp::Instant(at));
+ if tx.send(frame).await.is_err() {
+ break;
+ }
+ }
+ tx
+ });
+ let pipeline = OutputPipeline::builder(dir.join(rel("audio-input.ogg").as_str()))
+ .with_audio_source::<ChannelAudioSource>(ChannelAudioSourceConfig::new(mono_info, rx))
+ .with_timestamps(timestamps)
+ .build::<OggMuxer>(())
+ .await
+ .map_err(|e| anyhow!("mic pipeline: {e}"))?;
+ mic = Some((pipeline, emit, rel("audio-input.ogg")));
+ }
+
+ let mut system: Option<(OutputPipeline, AudioEmit, RelativePathBuf)> = None;
+ if spec.system_audio {
+ let track = marker_track(AudioSource::System, spec.duration);
+ let schedule =
+ audio_code::standard_schedule(AudioSource::System, 0.1, spec.duration - 0.1, 0.5);
+ let (mut tx, rx) = futures::channel::mpsc::channel::<AudioFrame>(32);
+ let emit = tokio::spawn(async move {
+ use futures::SinkExt;
+ for placement in schedule {
+ let first = (placement.time_secs / AUDIO_CHUNK_SECS).floor() as usize;
+ let last = ((placement.time_secs + audio_code::MARKER_SECS) / AUDIO_CHUNK_SECS)
+ .ceil() as usize;
+ for k in first..last {
+ let t = k as f64 * AUDIO_CHUNK_SECS;
+ let at = base + Duration::from_secs_f64(t);
+ tokio::time::sleep_until(at.into()).await;
+ let frame = AudioFrame::new(
+ audio_chunk(&track, t, &stereo_info),
+ Timestamp::Instant(at),
+ );
+ if tx.send(frame).await.is_err() {
+ return tx;
+ }
+ }
+ }
+ tx
+ });
+ let pipeline = OutputPipeline::builder(dir.join(rel("system_audio.ogg").as_str()))
+ .with_audio_source::<ChannelAudioSource>(ChannelAudioSourceConfig::new(stereo_info, rx))
+ .with_timestamps(timestamps)
+ .with_audio_anchor(cap_recording::AudioAnchor::PipelineEpoch)
+ .build::<OggMuxer>(())
+ .await
+ .map_err(|e| anyhow!("system audio pipeline: {e}"))?;
+ system = Some((pipeline, emit, rel("system_audio.ogg")));
+ }
+
+ // Wait for every device to finish delivering, keeping the audio senders
+ // open (real devices deliver until stop), then stop like the recorder.
+ screen.emit.await.context("screen emit")?;
+ let camera = match camera {
+ Some(leg) => {
+ let VideoLeg {
+ pipeline,
+ emit,
+ rel,
+ fps,
+ } = leg;
+ emit.await.context("camera emit")?;
+ Some((pipeline, rel, fps))
+ }
+ None => None,
+ };
+ let mut held = Vec::new();
+ let mut audio_pipelines = Vec::new();
+ for (name, leg) in [("mic", mic), ("system", system)] {
+ if let Some((pipeline, emit, rel)) = leg {
+ held.push(emit.await.context("audio emit")?);
+ audio_pipelines.push((name, pipeline, rel));
+ }
+ }
+ tokio::time::sleep(Duration::from_millis(300)).await;
+
+ let finished_screen = screen
+ .pipeline
+ .stop()
+ .await
+ .map_err(|e| anyhow!("screen stop: {e}"))?;
+ let start = |first: Timestamp| first.signed_duration_since_secs(timestamps);
+ let display = VideoMeta {
+ path: screen.rel,
+ fps: screen.fps,
+ start_time: Some(start(finished_screen.first_timestamp)),
+ device_id: None,
+ };
+ let camera = match camera {
+ Some((pipeline, rel, fps)) => {
+ let finished = pipeline
+ .stop()
+ .await
+ .map_err(|e| anyhow!("camera stop: {e}"))?;
+ Some(VideoMeta {
+ path: rel,
+ fps,
+ start_time: Some(start(finished.first_timestamp)),
+ device_id: None,
+ })
+ }
+ None => None,
+ };
+ let mut mic_meta = None;
+ let mut system_meta = None;
+ for (name, pipeline, rel) in audio_pipelines {
+ let finished = pipeline
+ .stop()
+ .await
+ .map_err(|e| anyhow!("{name} stop: {e}"))?;
+ let meta = AudioMeta {
+ path: rel,
+ start_time: Some(start(finished.first_timestamp)),
+ device_id: None,
+ gap_summary: finished
+ .audio_gap_summary
+ .map(|s| cap_project::AudioGapSummary {
+ total_overlap_trimmed_ms: s.total_overlap_trimmed_ms,
+ startup_overlap_trimmed_ms: s.startup_overlap_trimmed_ms,
+ overlap_dropped_frames: s.overlap_dropped_frames,
+ startup_overlap_drops: s.startup_overlap_drops,
+ }),
+ };
+ if name == "mic" {
+ mic_meta = Some(meta);
+ } else {
+ system_meta = Some(meta);
+ }
+ }
+ drop(held);
+ Ok(MultipleSegment {
+ display,
+ camera,
+ mic: mic_meta,
+ system_audio: system_meta,
+ cursor: None,
+ keyboard: None,
+ display_notch: None,
+ })
+}
+
+/// Records a Studio project (one recording segment per spec segment, like
+/// pause/resume) into `dir`.
+pub async fn record_studio(spec: &RecordedSpec, dir: &Path) -> anyhow::Result<()> {
+ crate::media::init();
+ if dir.exists() {
+ std::fs::remove_dir_all(dir)?;
+ }
+ let mut segments = Vec::new();
+ for (i, segment) in spec.segments.iter().enumerate() {
+ segments.push(record_segment(dir, i, segment).await?);
+ }
+ write_project_files(dir, &spec.name, segments)?;
+ Ok(())
+}
diff --git a/crates/verify/tests/common/mod.rs b/crates/verify/tests/common/mod.rs
index d56c0e5c6..1cca970d6 100644
--- a/crates/verify/tests/common/mod.rs
+++ b/crates/verify/tests/common/mod.rs
@@ -29,6 +29,7 @@ pub fn init() {
/// A ready fixture project plus its decoded source truth.
pub struct Project {
+ pub name: String,
pub path: PathBuf,
pub meta: RecordingMeta,
pub truth: SourceTruth,
@@ -38,9 +39,29 @@ pub fn project(spec: &FixtureSpec) -> Project {
init();
let path = fixture::ensure_fixture(spec, fixture::write_fixture)
.unwrap_or_else(|e| panic!("fixture {}: {e:?}", spec.name));
+ load(&spec.name, path)
+}
+
+fn load(name: &str, path: PathBuf) -> Project {
let meta = RecordingMeta::load_for_project(&path).expect("fixture meta");
let truth = SourceTruth::read(&path).expect("fixture truth");
- Project { path, meta, truth }
+ Project {
+ name: name.to_string(),
+ path,
+ meta,
+ truth,
+ }
+}
+
+/// A fixture recorded through the real recording pipeline (real time on
+/// first use, cached afterwards).
+pub fn recorded(spec: &cap_verify::pipeline::RecordedSpec) -> Project {
+ init();
+ let path = fixture::ensure_fixture_keyed(spec.cache_key(), |dir| {
+ runtime().block_on(cap_verify::pipeline::record_studio(spec, dir))
+ })
+ .unwrap_or_else(|e| panic!("recorded fixture {}: {e:?}", spec.name));
+ load(&format!("rec-{}", spec.name), path)
}
impl Project {
@@ -71,6 +92,24 @@ pub fn set_cuts(config: &mut ProjectConfiguration, cuts: &[(f64, f64, f64)]) {
.collect();
}
+/// Replaces the timeline with `(clip, start, end, timescale)` segments.
+pub fn set_clip_cuts(config: &mut ProjectConfiguration, cuts: &[(u32, f64, f64, f64)]) {
+ let timeline = config.timeline.as_mut().expect("timeline");
+ timeline.segments = cuts
+ .iter()
+ .map(|&(clip, start, end, timescale)| TimelineSegment {
+ recording_clip: clip,
+ start,
+ end,
+ timescale,
+ name: None,
+ speed_audio_mode: None,
+ hide_cursor: None,
+ volume: None,
+ })
+ .collect();
+}
+
pub fn add_transition(config: &mut ProjectConfiguration, segment_index: u32, duration: f64) {
let timeline = config.timeline.as_mut().expect("timeline");
timeline.transitions.push(ClipTransition {
diff --git a/crates/verify/tests/export.rs b/crates/verify/tests/export.rs
index 2fa2c5eec..ec07342ad 100644
--- a/crates/verify/tests/export.rs
+++ b/crates/verify/tests/export.rs
@@ -37,13 +37,30 @@ fn run(
resolution: (u32, u32),
determinism: bool,
) -> Vec<String> {
- let project = common::project(&spec);
+ run_project(
+ common::project(&spec),
+ variants,
+ formats,
+ decoders,
+ resolution,
+ determinism,
+ )
+}
+
+fn run_project(
+ project: common::Project,
+ variants: &[Variant],
+ formats: &[(Format, u32)],
+ decoders: &[Decoder],
+ resolution: (u32, u32),
+ determinism: bool,
+) -> Vec<String> {
let rt = common::runtime();
let mut failures = Vec::new();
for variant in variants {
for &(format, fps) in formats {
for &decoder in decoders {
- let id = case_id(&spec.name, variant.edit, format, fps, decoder);
+ let id = case_id(&project.name, variant.edit, format, fps, decoder);
if !report::selected(&id) {
continue;
}
@@ -301,3 +318,33 @@ fn multi_segment() {
));
common::assert_passed(failures);
}
+
+fn across_segments(config: &mut ProjectConfiguration) {
+ common::set_clip_cuts(
+ config,
+ &[(0, 0.5, 3.0, 1.0), (1, 0.5, 2.5, 1.0), (0, 3.5, 5.5, 1.5)],
+ );
+}
+
+/// A Studio project recorded through the real recording pipeline.
+#[test]
+fn recorded_studio() {
+ let failures = run_project(
+ common::recorded(&catalog::recorded_studio(report::tier())),
+ &[
+ Variant {
+ edit: "full",
+ apply: no_edit,
+ },
+ Variant {
+ edit: "across-segments",
+ apply: across_segments,
+ },
+ ],
+ &[(Format::Mp4, 30), (Format::Mp4, 60)],
+ &Decoder::all(),
+ RES,
+ false,
+ );
+ common::assert_passed(failures);
+}
diff --git a/crates/verify/tests/playback.rs b/crates/verify/tests/playback.rs
index e7e471c6d..62d02015f 100644
--- a/crates/verify/tests/playback.rs
+++ b/crates/verify/tests/playback.rs
@@ -43,13 +43,21 @@ fn sequential(
fps: u32,
start_fraction: f64,
) -> Vec<String> {
- let project = common::project(&spec);
+ sequential_project(common::project(&spec), edit, fps, start_fraction)
+}
+
+fn sequential_project(
+ project: common::Project,
+ edit: (&str, fn(&mut ProjectConfiguration)),
+ fps: u32,
+ start_fraction: f64,
+) -> Vec<String> {
let rt = common::runtime();
let mut failures = Vec::new();
for decoder in Decoder::all() {
let id = format!(
"playback/{}/{}/seq{fps}-from{:.0}/{}",
- spec.name,
+ project.name,
edit.0,
start_fraction * 100.0,
decoder.label()
@@ -173,3 +181,14 @@ fn multi_segment_sequential() {
));
common::assert_passed(failures);
}
+
+#[test]
+fn recorded_studio_sequential() {
+ let failures = sequential_project(
+ common::recorded(&catalog::recorded_studio(report::tier())),
+ ("full", no_edit),
+ 60,
+ 0.0,
+ );
+ common::assert_passed(failures);
+}
diff --git a/crates/verify/tests/seek.rs b/crates/verify/tests/seek.rs
index b62fb293a..a0ba5cb8d 100644
--- a/crates/verify/tests/seek.rs
+++ b/crates/verify/tests/seek.rs
@@ -26,11 +26,20 @@ fn run(
edit: fn(&mut ProjectConfiguration),
make: &dyn Fn(u32, &common::Project) -> Vec<Request>,
) -> Vec<String> {
- let project = common::project(&spec);
+ run_project(common::project(&spec), name, fps, edit, make)
+}
+
+fn run_project(
+ project: common::Project,
+ name: &str,
+ fps: u32,
+ edit: fn(&mut ProjectConfiguration),
+ make: &dyn Fn(u32, &common::Project) -> Vec<Request>,
+) -> Vec<String> {
let rt = common::runtime();
let mut failures = Vec::new();
for decoder in Decoder::all() {
- let id = format!("seek/{}/{name}{fps}/{}", spec.name, decoder.label());
+ let id = format!("seek/{}/{name}{fps}/{}", project.name, decoder.label());
if !report::selected(&id) {
continue;
}
@@ -273,7 +282,7 @@ fn cold_open() {
let rt = common::runtime();
let mut failures = Vec::new();
for decoder in Decoder::all() {
- let id = format!("seek/{}/cold-open30/{}", spec.name, decoder.label());
+ let id = format!("seek/{}/cold-open30/{}", project.name, decoder.label());
if !report::selected(&id) {
continue;
}