mirror of
https://github.com/storytold/filmcraft.git
synced 2026-11-10 07:41:19 +00:00
* Tests: one integration-test binary per crate Each crate with several tests/*.rs files keeps them as modules of tests/it/, so cargo links one test executable per crate instead of one per file. Files that change process-wide state or time a workload stay binaries of their own. * Profiles: line tables for workspace crates, no debug info for dependencies * Windows ARM64: nightly and on release pushes instead of every push to main * xtask ci: clippy and tests in the dev profile The release profile's thin LTO and single codegen unit made linking the test binaries take most of the gate. The codec and audio crates stay at opt-level 3 in the dev profile, so their tests run at release speed. * xtask ci: nextest, doctests, no examples, one wasm check Tests run with cargo nextest when it is installed (cargo test otherwise) and build with --lib --bins --tests, so examples aren't linked; doctests run separately. The wasm check keeps going past the first failing crate. VP8 fixture generation locks across processes, since nextest runs each test in its own. * VP9 synthetic fixtures: write aside and rename A test in another process could read a fixture ffmpeg was still writing. * Fuzz tests: a third of each sweep by default, all of it with FILMCRAFT_FUZZ_ITERS Every seed, mutation kind and thread count still runs. Header bytes each get one overwrite value and two bit flips in rotation, so every value and bit index still occurs across the region. FILMCRAFT_FUZZ_ITERS=N runs the whole sweep plus N random rounds per seed, as before. * Platform fallback tests: one failure point per hybrid path The failure-anywhere test injected a failure at four points around every restart point; the hybrid's paths differ only in the first GOP, around the second and last restart points, at the end and never. The replay test needs the first two GOPs. * Export tests: shorter ranges with the same checks The bitrate test measures 0.5–1.5 s, where each preset reaches its own target (on 0–3 s the simple demo left two presets at the same rate). The every-preset test exports three frames per preset. * Audio tests: effects in parallel, a table-driven FFT for the Opus quality metric The extreme-settings test keeps both settings and the 40 s tail for every effect, one thread each. The Opus quality metric's FFT builds its twiddles once and allocates nothing per transform (same algorithm and summation order). * CI: dev-profile gate with nextest xtask ci no longer builds with --release, so the release-profile overrides go; nextest is installed for the test step. * CI: apt packages through the cached install-apt-packages action * Review fixes: fuzz tests with a panic hook in their own binaries, loud fixture lock The fuzz tests of av1, h264, hevc, mpeg2v, vp8 and vp9 count panics through a process-wide hook, so a panic in another test of the same process would fail them; they are binaries of their own again. The VP8 fixture lock fails the test instead of skipping it silently, and the full-sweep doc comments say how many truncation points the full run samples. * Fuzz tests: rotate the default subset per run (FILMCRAFT_FUZZ_SEED replays one) * platform tests: decode-switch tests in their own binaries, one NVENC lock
70 lines
3.2 KiB
Rust
70 lines
3.2 KiB
Rust
//! VA-API decoders share one display (Linux). Opening a display takes 0.2-0.3 s with NVIDIA's
|
|
//! driver (about 100 MB of video memory each) and terminating one 60-70 ms, on the thread that
|
|
//! creates or drops the decoder (a frame worker at every clip, the UI thread when media is
|
|
//! removed), so the process opens one and every decoder makes only its own context and surfaces on
|
|
//! it, also several decoders at once on different threads. Its own test binary: the count of
|
|
//! opened displays is process-wide, and other tests running at the same time would change it.
|
|
//! Skips without ffmpeg (fixture generator) or without a VA-API driver.
|
|
#![cfg(target_os = "linux")]
|
|
|
|
#[path = "it/common/mod.rs"]
|
|
mod common;
|
|
|
|
use common::*;
|
|
use filmcraft_codecs::VideoDecoder;
|
|
use filmcraft_platform::vaapi::va::displays_opened;
|
|
|
|
fn hardware(s: &Stream) -> Option<Box<dyn VideoDecoder>> {
|
|
match filmcraft_platform::vaapi_factory(&s.entry) {
|
|
Some(Ok(d)) if d.name().starts_with("VA-API") => Some(d),
|
|
_ => {
|
|
eprintln!("SKIPPED: no VA-API decoder for this stream on this machine");
|
|
None
|
|
}
|
|
}
|
|
}
|
|
|
|
#[test]
|
|
fn decoders_share_one_display() {
|
|
let ff = filmcraft_testkit::require_ffmpeg!();
|
|
let paths: Vec<_> = FIXTURES.iter().filter_map(|(name, _)| named(&ff, name)).collect();
|
|
let streams: Vec<_> = paths.iter().map(|p| read_stream(p)).collect();
|
|
let Some(first) = streams.first() else { return };
|
|
let Some(hw) = hardware(first) else { return };
|
|
drop(hw);
|
|
let opened = displays_opened();
|
|
assert_eq!(opened, 1, "the first decoder opened one display");
|
|
|
|
// one decoder after another, of every fixture (H.264, HEVC Main, HEVC Main 10)
|
|
for round in 0..10 {
|
|
for s in &streams {
|
|
let Some(mut hw) = hardware(s) else { return };
|
|
let n = s.samples.len().min(13);
|
|
let reference = decode_all(filmcraft_codecs::software_video_decoder(&s.entry).unwrap().as_mut(), &s.samples[..n]);
|
|
assert_same(&format!("round {round}"), &decode_all(hw.as_mut(), &s.samples[..n]), &reference);
|
|
}
|
|
}
|
|
assert_eq!(displays_opened(), opened, "decoders one after another open no display");
|
|
|
|
// several decoders at once on different threads, each used from its own thread, repeatedly
|
|
for round in 0..3 {
|
|
let jobs: Vec<_> = (0..6)
|
|
.map(|i| {
|
|
let path = paths[i % paths.len()].clone();
|
|
std::thread::spawn(move || {
|
|
let s = read_stream(&path);
|
|
let Some(mut hw) = hardware(&s) else { return };
|
|
let reference = decode_all(filmcraft_codecs::software_video_decoder(&s.entry).unwrap().as_mut(), &s.samples);
|
|
assert_same(&format!("round {round}, thread {i}"), &decode_all(hw.as_mut(), &s.samples), &reference);
|
|
hw.reset();
|
|
assert_same(&format!("round {round}, thread {i}, after a reset"), &decode_all(hw.as_mut(), &s.samples), &reference);
|
|
})
|
|
})
|
|
.collect();
|
|
for j in jobs {
|
|
j.join().unwrap();
|
|
}
|
|
}
|
|
assert_eq!(displays_opened(), opened, "decoders at once on several threads open no display");
|
|
}
|