forge
Explore
Log in

Don't you dare go Hollow

edith

Clone
★ 0

0 watching0 forksRust18.3 MiBff99ad6Tahinli6 days ago1055 commits

speed.rs595 lines, 24.1 KiBHistoryRawDownload
1//! Per-clip speed where it has to be true: in the pictures a preview shows, in
2//! the samples the device is fed, in the file an export writes, and in the
3//! project file the whole lot survives in.
4//!
5//! Everything goes through the front door. A `Project` is edited with
6//! `set_speed` and then read exactly as `PlaybackSession::seek` reads it --
7//! `audio_segments_from` + `audio_eqs_from` + `audio_speeds_from` handed to the
8//! same opener playback hands them to, and `composite_span_at` handed to the
9//! same decoder. Nothing calls the resampler directly; `project.rs`'s own unit
10//! tests own the placement arithmetic, and what is measured here is the wiring.
11//!
12//! The fixture is `test_speed_sync.mp4` (`gen_fixtures.sh`): black with one white
13//! flash from t=1.0 to t=1.1, silent with a 1 kHz beep over exactly that
14//! stretch. A re-timed clip that drifts puts the beep where the flash is not,
15//! which is the whole reason that file exists.
16
17use std::path::PathBuf;
18use std::time::{Duration, Instant};
19
20use engine::export::{ExportSettings, Format};
21use engine::project::{Lane, Speed};
22use engine::scratch::Scratch;
23use engine::{AudioSession, Clip, DecodeSession, ExportHandle, Project};
24
25const RATE: u32 = 44_100;
26const FPS: f64 = 30.0;
27
28fn asset(name: &str) -> PathBuf {
29 PathBuf::from(env!("CARGO_MANIFEST_DIR"))
30 .join("../../assets")
31 .join(name)
32}
33
34/// The sync fixture as a fresh project: one video clip and one audio clip,
35/// grouped, covering the whole file -- what opening it in the editor gives.
36fn sync_project() -> (Project, engine::VideoMeta) {
37 let path = asset("test_speed_sync.mp4");
38 let (meta, _) = engine::demux::Demuxer::open(&path).expect("open the sync fixture");
39 (Project::single(&path, meta.frame_count), meta)
40}
41
42/// What the device would be fed, drained to the end: the exact three lists
43/// `PlaybackSession::seek` builds, handed to the exact opener it hands them to.
44fn play(project: &Project) -> Vec<f32> {
45 let sources = project.audio_sources();
46 let segs = project.audio_segments_from(0, FPS);
47 let eqs = project.audio_eqs_from(0, FPS);
48 let speeds = project.audio_speeds_from(0, FPS);
49 let (meta, chunks) = AudioSession::open_mixed_streams_speed(&sources, &segs, &eqs, &speeds)
50 .expect("open the timeline's audio")
51 .expect("the timeline has audio");
52 assert_eq!((meta.sample_rate, meta.channels), (RATE, 2));
53 let mut samples = Vec::new();
54 for chunk in chunks {
55 samples.extend(chunk.samples);
56 }
57 samples
58}
59
60/// When the beep starts, in timeline seconds: the first sample above a tenth of
61/// full scale, which the silence around it is nowhere near.
62fn beep_at(samples: &[f32]) -> f64 {
63 let at = samples
64 .iter()
65 .position(|s| s.abs() > 0.1)
66 .expect("the fixture beeps");
67 at as f64 / 2.0 / f64::from(RATE)
68}
69
70/// When the flash shows, in timeline seconds: the first frame the composite maps
71/// to a white picture, walked exactly as `PlaybackSession::try_frame` walks it
72/// -- the decoder is opened over the span's *source* range and its frame numbers
73/// come back through the span's own rate.
74fn flash_at(project: &Project) -> f64 {
75 let span = project.composite_span_at(0).expect("a span at frame 0");
76 let (source, in_frame) = span.from.expect("the span plays a clip");
77 let path = &project.sources()[source].path;
78 let (_, frames, _) = DecodeSession::open_range(path, in_frame, in_frame + span.source_len())
79 .expect("open the fixture's picture");
80 for frame in frames {
81 // Mid-picture, so a stray edge pixel cannot answer for the frame.
82 let middle = frame.bgra.len() / 2 / 4 * 4;
83 if frame.bgra[middle] > 200 {
84 let timeline = span.start + span.speed.timeline_at(frame.index - in_frame);
85 return f64::from(timeline) / FPS;
86 }
87 }
88 panic!("the fixture flashes");
89}
90
91fn wait(handle: &ExportHandle, limit: Duration) -> engine::Result<()> {
92 let started = Instant::now();
93 while !handle.is_finished() {
94 assert!(started.elapsed() < limit, "export did not finish");
95 std::thread::sleep(Duration::from_millis(20));
96 }
97 handle.result().expect("a finished export has an outcome")
98}
99
100fn out_path(name: &str, ext: &str) -> Scratch {
101 Scratch::file(&format!("edith-speed-{name}"), ext)
102}
103
104/// The headline: a clip at 2x is half as long on the timeline, plays the same
105/// source range, and its box is the one thing that moved.
106#[test]
107fn a_clip_at_2x_takes_half_the_timeline_and_the_same_source() {
108 let (mut project, _) = sync_project();
109 let before = project.clips()[0].clone();
110 project
111 .set_speed(Lane::V1, 0, Speed::from_permille(2000))
112 .expect("nothing is in the way of a clip that got shorter");
113 let after = project.clips()[0].clone();
114 assert_eq!(
115 (after.in_frame, after.out_frame),
116 (before.in_frame, before.out_frame),
117 "the source range a trim and a split address is untouched"
118 );
119 assert_eq!(
120 after.frames(),
121 before.frames().div_ceil(2),
122 "half the timeline frames, rounded"
123 );
124 assert_eq!(project.timeline_frames(), after.frames());
125 // ...and its sound with it, on the other lane: one rate for the group.
126 assert_eq!(project.speed_of(Lane::A1, 0).permille(), 2000);
127 assert_eq!(project.lane(Lane::A1)[0].end(), after.end());
128}
129
130/// The invariant a footprint may never break, over the whole legal range: a
131/// clip always occupies at least one frame, whatever it is divided by.
132#[test]
133fn no_rate_ever_makes_a_clip_occupy_nothing() {
134 for permille in [250, 333, 500, 999, 1000, 1001, 1500, 2000, 3999, 4000] {
135 let speed = Speed::from_permille(permille);
136 for len in [1, 2, 3, 7, 30, 999] {
137 assert!(
138 speed.frames(len) >= 1,
139 "{len} source frames at {speed} occupies nothing"
140 );
141 }
142 }
143}
144
145/// Slowing a clip down makes it wider, and a lane may not overlap itself: the
146/// refusal *names* the clip in the way, and costs no undo step.
147#[test]
148fn a_slow_down_into_the_next_clip_is_refused_by_name() {
149 let (mut project, meta) = sync_project();
150 let half = meta.frame_count / 2;
151 assert!(project.split(half), "cut the take in two");
152 let before = project.clips().to_vec();
153 let text = project
154 .set_speed(Lane::V1, 0, Speed::from_permille(500))
155 .expect_err("the first half cannot double in length where it sits")
156 .to_string();
157 assert!(text.contains(&half.to_string()), "{text}");
158 assert!(text.contains("0.50x"), "{text}");
159 assert_eq!(project.clips(), before, "nothing moved");
160 // ...and the refusal cost no undo step of its own: the one press left is
161 // the split's, which puts the take back together.
162 assert!(project.undo(), "the split is still the last thing undone");
163 assert_eq!(project.clips().len(), 1, "the take is whole again");
164 assert!(!project.undo(), "and nothing else was ever pushed");
165}
166
167/// One rate change is one undo press, for the whole linked group -- the picture
168/// and the sound come back together.
169#[test]
170fn one_speed_change_is_one_undo_for_the_whole_group() {
171 let (mut project, _) = sync_project();
172 let (video, audio) = (project.clips().to_vec(), project.lane(Lane::A1).to_vec());
173 project
174 .set_speed(Lane::A1, 0, Speed::from_permille(2000))
175 .expect("room enough");
176 // A drag is one snapshot and then live writes, which is what keeps a
177 // gesture across the card's bar one undo and not forty.
178 for permille in [1500, 1750, 4000] {
179 project
180 .set_speed_live(Lane::A1, 0, Speed::from_permille(permille))
181 .expect("room enough");
182 }
183 assert!(project.undo(), "one press");
184 assert_eq!(project.clips(), video, "the picture is back");
185 assert_eq!(project.lane(Lane::A1), audio, "and its sound with it");
186 assert!(!project.undo(), "there was only ever one step");
187}
188
189/// A rate follows the clip through a split and through the clipboard, exactly
190/// as an equalizer does: both halves keep it, and so does a paste.
191#[test]
192fn speed_survives_a_split_and_a_paste() {
193 let (mut project, meta) = sync_project();
194 project
195 .set_speed(Lane::V1, 0, Speed::from_permille(2000))
196 .expect("room enough");
197 let whole = project.clips()[0].frames();
198 assert!(project.split(whole / 2), "a 2x clip cuts on any frame");
199 let halves = project.clips().to_vec();
200 assert_eq!(halves.len(), 2);
201 assert!(
202 halves.iter().all(|c| c.speed.permille() == 2000),
203 "both halves play at the rate the whole did"
204 );
205 assert_eq!(
206 halves[0].frames() + halves[1].frames(),
207 whole,
208 "and they still add up to the clip that was cut"
209 );
210 assert_eq!(halves[0].out_frame, halves[1].in_frame, "in source frames");
211 assert_eq!(halves[1].end(), whole, "the lane is unchanged in length");
212
213 let copied = halves[0].clone();
214 assert!(project.paste(whole, copied.clone()), "paste it at the end");
215 let pasted = project.clips().last().expect("something was pasted").clone();
216 assert_eq!(pasted.speed, copied.speed, "a copy carries the rate");
217 assert_eq!(
218 pasted.frames(),
219 copied.frames(),
220 "and therefore the room it takes"
221 );
222 let _ = meta;
223}
224
225/// The one the anti-list is about: at 2x the beep still lands on the flash. The
226/// picture comes off the decoder through the span's own rate and the sound comes
227/// out of the resampler in the worker -- two independent paths, measured against
228/// each other.
229#[test]
230fn the_beep_stays_on_the_flash_at_every_rate() {
231 // Where the fixture's own mark sits, measured rather than assumed: what the
232 // rates below are checked against is this, divided.
233 let (base, _) = sync_project();
234 let (mark, mark_beep) = (flash_at(&base), beep_at(&play(&base)));
235 println!("real time: flash at {mark:.3}s, beep at {mark_beep:.3}s");
236 assert!(
237 (mark - mark_beep).abs() <= 1.0 / FPS && mark > 2.0 / FPS,
238 "the fixture's flash and beep are its whole point: {mark:.3}s / {mark_beep:.3}s"
239 );
240 for permille in [2000, 500, 1500] {
241 let (mut project, _) = sync_project();
242 let speed = Speed::from_permille(permille);
243 project
244 .set_speed(Lane::V1, 0, speed)
245 .expect("one clip on the timeline has room for any rate");
246 let flash = flash_at(&project);
247 let beep = beep_at(&play(&project));
248 let apart = (flash - beep).abs();
249 println!("{speed}: flash at {flash:.3}s, beep at {beep:.3}s, {apart:.3}s apart");
250 assert!(
251 apart <= 1.0 / FPS,
252 "{speed}: the beep is {apart:.3}s off the flash, which is more than a frame"
253 );
254 // ...and both of them moved: at 2x the mark is at half its own time, and
255 // a test that measured two things standing still would pass forever.
256 let expected = mark / speed.as_f64();
257 assert!(
258 (flash - expected).abs() <= 2.0 / FPS,
259 "{speed}: the flash should be around {expected:.3}s, not {flash:.3}s"
260 );
261 }
262}
263
264/// A WAV of a speeded timeline is as long as the timeline says, and it is the
265/// sound that was heard -- the beep in the file sits where the preview put it.
266#[test]
267fn a_wav_export_of_a_2x_timeline_matches_the_preview() {
268 let (mut project, meta) = sync_project();
269 project
270 .set_speed(Lane::V1, 0, Speed::from_permille(2000))
271 .expect("room enough");
272 let frames = project.timeline_frames();
273 let heard = beep_at(&play(&project));
274 let out = out_path("wav", "wav");
275 let handle = engine::export::start(
276 project,
277 meta,
278 &out,
279 &ExportSettings {
280 format: Format::Wav,
281 ..Default::default()
282 },
283 None,
284 );
285 wait(&handle, Duration::from_secs(120)).expect("wav export");
286 let mut reader = ec_riff::WavReader::open(&out).expect("read the export back");
287 let spec = reader.spec();
288 let samples: Vec<f32> = reader
289 .read_all_i32()
290 .expect("the samples")
291 .into_iter()
292 .map(|s| s as f32 / f32::from(i16::MAX))
293 .collect();
294 let written = samples.len() / usize::from(spec.channels);
295 let expected = (f64::from(frames) / FPS * f64::from(RATE)).round() as usize;
296 assert!(
297 written.abs_diff(expected) <= spec.sample_rate as usize / 30,
298 "the file is {written} frames and the timeline is {expected}"
299 );
300 let in_file = beep_at(&samples);
301 assert!(
302 (in_file - heard).abs() <= 1.0 / FPS,
303 "the beep is at {in_file:.3}s in the file and was at {heard:.3}s in the preview"
304 );
305 std::fs::remove_file(&out).ok();
306}
307
308/// The other half of the same rule, and it used to be a refusal: an mp4 *copies*
309/// AAC packets and a packet carries no rate, so a speeded clip on the lane being
310/// copied could only have come out at 1.00x under a re-timed picture. It is
311/// decoded, resampled and encoded again now (`export::copy_audio` routes a
312/// speeded lane to `encode_audio`), so the file carries the sound that was
313/// heard -- measured the way the WAV above is, by where the beep lands.
314#[test]
315fn an_mp4_export_resamples_a_speeded_sound_clip() {
316 let (mut project, meta) = sync_project();
317 project
318 .set_speed(Lane::A1, 0, Speed::from_permille(2000))
319 .expect("room enough");
320 let heard = beep_at(&play(&project));
321 let out = out_path("speeded", "mp4");
322 let handle = engine::export::start(project, meta, &out, &ExportSettings::default(), None);
323 wait(&handle, Duration::from_secs(180)).expect("an mp4 of a speeded sound clip");
324 let (audio, chunks) = AudioSession::open(&out)
325 .expect("reopen the export")
326 .expect("it has an audio track");
327 assert_eq!(audio.sample_rate, RATE);
328 let samples: Vec<f32> = chunks.into_iter().flat_map(|c| c.samples).collect();
329 let in_file = beep_at(&samples);
330 assert!(
331 (in_file - heard).abs() <= 1.0 / FPS,
332 "the beep is at {in_file:.3}s in the file and was at {heard:.3}s in the preview"
333 );
334 std::fs::remove_file(&out).ok();
335}
336
337/// The amplitude of `hz` inside `samples`, by Goertzel at the fixture's rate
338/// over a fixed window: the pitch meter the pitch tests assert with, rather
339/// than trusting that a re-timed beep *sounds* unchanged.
340fn tone(samples: &[f32], hz: f64) -> f64 {
341 let n = samples.len() as f64;
342 let w = 2. * std::f64::consts::PI * hz / f64::from(RATE);
343 let coeff = 2. * w.cos();
344 let (mut s1, mut s2) = (0., 0.);
345 for &x in samples {
346 let s0 = f64::from(x) + coeff * s1 - s2;
347 s2 = s1;
348 s1 = s0;
349 }
350 2. * (s1 * s1 + s2 * s2 - coeff * s1 * s2).sqrt() / n
351}
352
353/// The beep's own frequency in the played samples, to the nearest strong
354/// Goertzel bin: the fixture's beep is 1 kHz, and this walks a coarse ladder
355/// of bins around it so the measurement is of *where the energy sits*, not of
356/// one bin that could be low for its own reasons.
357fn beep_hz(samples: &[f32], at: f64) -> f64 {
358 // One channel, before anything else: the stream is interleaved stereo,
359 // and a Goertzel fed a 1 kHz tone woven with its own copy reads a
360 // carrier, not the tone.
361 let mono: Vec<f32> = samples.chunks(2).map(|f| f[0]).collect();
362 let samples = &mono[..];
363 // The beep is a tenth of a second at real time and shrinks with the rate,
364 // so the window is centred on the loudest sample at or after its start
365 // and is a fifth of a second wide: the beep whole, the silence around it
366 // mostly out, at every rate the engine can hold.
367 let stereo = f64::from(RATE);
368 let from = (at * stereo) as usize;
369 let peak = samples[from..]
370 .iter()
371 .enumerate()
372 .max_by(|(_, a), (_, b)| a.abs().total_cmp(&b.abs()))
373 .map(|(i, _)| from + i)
374 .expect("a sample after the beep starts");
375 let half = (stereo * 0.1) as usize;
376 let window = &samples[peak.saturating_sub(half)..(peak + half).min(samples.len())];
377 (700..=1400)
378 .step_by(25)
379 .map(|hz| (tone(window, f64::from(hz)), hz))
380 .max_by(|(a, _), (b, _)| a.total_cmp(b))
381 .expect("a window to measure")
382 .1 as f64
383}
384
385/// The pitch itself: a 2x clip plays its beep at 1 kHz, not the octave. The
386/// tape effect -- one resample at the speed -- put it there (this ladder's
387/// peak reads 1350 Hz on this fixture before the stretch landed, the octave
388/// smeared by how short the re-timed beep is); the time-stretch behind the
389/// rate conversion keeps every period of the signal its own length, beep
390/// included.
391#[test]
392fn a_2x_clip_keeps_the_beeps_pitch() {
393 let (mut project, _) = sync_project();
394 project
395 .set_speed(Lane::V1, 0, Speed::from_permille(2000))
396 .expect("room for it");
397 let played = play(&project);
398 let at = beep_at(&played);
399 let hz = beep_hz(&played, at);
400 assert!(
401 (hz - 1000.).abs() <= 1000. * 0.02,
402 "the beep measures {hz} Hz: the tape effect would put it near 2000"
403 );
404}
405
406
407/// The playhead follows the re-rate: the source frame under it is the same
408/// frame after the write (the scene does not change with the rate), through
409/// the real session doors -- commit and the live samples of a drag both.
410#[test]
411fn the_playhead_follows_the_re_rate() {
412 let path = asset("test_speed_sync.mp4");
413 let mut session = engine::PlaybackSession::open(&path).expect("open the fixture");
414 // Park inside the clip, at a frame a re-rate must not lose: the source
415 // frame playing *now* is what the cursor is standing on.
416 session.seek(2.0);
417 let before = session.video_source_frame_at(2.0);
418 session
419 .set_speed(Lane::V1, 0, Speed::from_permille(2000))
420 .expect("room for it");
421 let now = session.now();
422 let after = session.video_source_frame_at(now);
423 assert_eq!(before, after, "the same source frame is under the playhead");
424 assert!((now - 1.0).abs() < 2.0 / FPS, "and the minute moved to {now}");
425 // The live path keeps it across the whole gesture: two samples of a drag
426 // leave the same frame playing, not the one the rate walked past.
427 session
428 .set_speed(Lane::V1, 0, Speed::from_permille(1500))
429 .expect("the bar moves");
430 let hold = session.now();
431 let held_frame = session.video_source_frame_at(hold);
432 session
433 .set_speed_live(Lane::V1, 0, Speed::from_permille(2500))
434 .expect("the bar moves again");
435 let still = session.video_source_frame_at(session.now());
436 assert_eq!(held_frame, still, "a live sample keeps the scene");
437}
438
439/// The symmetric half: a clip at half speed plays its beep at 1 kHz too, not
440/// the sub-octave the tape effect would leave there.
441#[test]
442fn a_half_speed_clip_keeps_the_beeps_pitch() {
443 let (mut project, _) = sync_project();
444 project
445 .set_speed(Lane::V1, 0, Speed::from_permille(500))
446 .expect("room for it");
447 let played = play(&project);
448 let at = beep_at(&played);
449 let hz = beep_hz(&played, at);
450 assert!(
451 (hz - 1000.).abs() <= 1000. * 0.02,
452 "the beep measures {hz} Hz: the tape effect would put it near 500"
453 );
454}
455
456/// The export's own path, measured the same way: a 2x WAV carries the beep at
457/// 1 kHz, so what a file plays is what the preview played -- the stretch sits
458/// at the one choke point both of them go through.
459#[test]
460fn a_wav_export_of_a_2x_clip_keeps_the_beeps_pitch() {
461 let (mut project, meta) = sync_project();
462 project
463 .set_speed(Lane::V1, 0, Speed::from_permille(2000))
464 .expect("room for it");
465 let out = out_path("pitch", "wav");
466 let handle = engine::export::start(
467 project,
468 meta,
469 &out,
470 &ExportSettings {
471 format: Format::Wav,
472 ..Default::default()
473 },
474 None,
475 );
476 wait(&handle, Duration::from_secs(120)).expect("wav export");
477 let mut reader = ec_riff::WavReader::open(&out).expect("read the export back");
478 let samples: Vec<f32> = reader
479 .read_all_i32()
480 .expect("the samples")
481 .into_iter()
482 .map(|s| s as f32 / f32::from(i16::MAX))
483 .collect();
484 let at = beep_at(&samples);
485 let hz = beep_hz(&samples, at);
486 assert!(
487 (hz - 1000.).abs() <= 1000. * 0.02,
488 "the beep in the file measures {hz} Hz, not the 1 kHz it was recorded at"
489 );
490 std::fs::remove_file(&out).ok();
491}
492
493/// The half that honours, and the shape that catches a walk that only works at
494/// one rate: **2x then 1x on the same lane**. Each span picks its own source
495/// frames, so the mark inside the fast clip lands at half its source offset and
496/// the mark inside the slow one lands where it always did -- one coded picture
497/// per timeline frame throughout.
498///
499/// The sound stays at 1.00x, which is what leaves the packet copy something it
500/// can carry (the refusal above is the other half of the same rule). Software
501/// encode, so this needs no plugin.
502#[test]
503fn an_mp4_export_honours_a_speeded_picture_across_a_rate_change() {
504 engine::envcfg::set("VE_SW", "1");
505 let (mut project, meta) = sync_project();
506 // Only the picture: detach it from its sound first, or the rate would land
507 // on the copied lane and be refused.
508 assert!(
509 project.ungroup(Lane::V1, 0),
510 "take the picture off the take"
511 );
512 project
513 .set_speed(Lane::V1, 0, Speed::from_permille(2000))
514 .expect("room enough");
515 assert_eq!(project.speed_of(Lane::A1, 0), Speed::NORMAL, "sound is 1x");
516 let fast = project.lane(Lane::V1)[0].frames();
517 assert_eq!(fast, 45, "90 source frames at 2x is 45 on the timeline");
518 // ...and the same take again behind it, at real time.
519 let whole = project.lane(Lane::V1)[0].clone();
520 assert!(
521 project.place(
522 Lane::V1,
523 fast,
524 Clip {
525 fade_in: 0,
526 fade_out: 0,
527 speed: Speed::NORMAL,
528 ..whole
529 }
530 ),
531 "a second, unspeeded clip of the same source"
532 );
533 let total = project.timeline_frames();
534 assert_eq!(total, fast + 90, "45 fast frames then 90 slow ones");
535
536 let out = out_path("honoured", "mp4");
537 let handle = engine::export::start(project, meta, &out, &ExportSettings::default(), None);
538 wait(&handle, Duration::from_secs(300)).expect("an mp4 export of a speeded picture");
539 let (_, frames) = DecodeSession::open(&out).expect("reopen the export");
540 let frames: Vec<_> = frames.into_iter().collect();
541 assert_eq!(
542 frames.len() as u32,
543 total,
544 "one coded picture per timeline frame"
545 );
546 let bright: Vec<u32> = frames
547 .iter()
548 .filter(|frame| {
549 frame.bgra.iter().map(|&b| u64::from(b)).sum::<u64>() / frame.bgra.len() as u64 > 128
550 })
551 .map(|frame| frame.index)
552 .collect();
553 // The fixture flashes for four source frames, 30..=33. At 2x the walk takes
554 // every second one, so the flash is two timeline frames wide and starts at
555 // 15; in the clip behind it, at real time, it is its full four frames and
556 // starts at 45 + 30. Exactly that -- a walk that decoded per timeline frame
557 // instead of per source frame would smear the mark or lose it.
558 assert_eq!(
559 bright,
560 vec![15, 16, 75, 76, 77, 78],
561 "the flash halved at 2x, then whole at 1.00x"
562 );
563 std::fs::remove_file(&out).ok();
564}
565
566/// AV1 honours a speeded picture with no detaching and no refusal -- and its
567/// sound, which it now carries, is resampled exactly as the mp4's is.
568#[test]
569fn an_av1_export_honours_a_speeded_take_whole() {
570 let (mut project, meta) = sync_project();
571 project
572 .set_speed(Lane::V1, 0, Speed::from_permille(2000))
573 .expect("room enough");
574 let total = project.timeline_frames();
575 let out = out_path("av1", "mkv");
576 let handle = engine::export::start(
577 project,
578 meta,
579 &out,
580 &ExportSettings {
581 format: Format::Av1,
582 ..Default::default()
583 },
584 None,
585 );
586 wait(&handle, Duration::from_secs(600)).expect("an AV1 export of a speeded take");
587 assert!(out.exists(), "AV1 never refuses a rate");
588 assert!(
589 std::fs::metadata(&out).expect("the export").len() > 0,
590 "and it wrote something"
591 );
592 // The timeline halved with the take, so the file is the shorter one.
593 assert_eq!(total, 45, "the whole take at 2x");
594 std::fs::remove_file(&out).ok();
595}