From 847b55fafbf0e38db836fad43a1db05a1c8859ce Mon Sep 17 00:00:00 2001 From: selikhov Date: Sat, 3 Oct 2026 01:42:18 +0300 Subject: [PATCH] WIP: round-trip test for the hardware encoders (interrupted by a session limit) Co-Authored-By: Claude Opus 5.5 --- Cargo.lock | 1 + crates/voelin-media/tests/ffmpeg.rs | 28 ++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/Cargo.lock b/Cargo.lock index 2c2b55e..01a76aa 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -9188,6 +9188,7 @@ dependencies = [ "tokio", "tracing", "tracing-subscriber", + "voelin-stream", "wasapi", "wayland-client", "wayland-protocols", diff --git a/crates/voelin-media/tests/ffmpeg.rs b/crates/voelin-media/tests/ffmpeg.rs index a614d4f..bbb330a 100644 --- a/crates/voelin-media/tests/ffmpeg.rs +++ b/crates/voelin-media/tests/ffmpeg.rs @@ -148,6 +148,34 @@ fn software_encoders_roundtrip() { eprintln!("tested: {tested:?}"); } +/// What the GPU encoders produce, through the same round-trip as the +/// software ones: our own decoders have to decode it (OpenH264 for H.264 with +/// `VOELIN_OPENH264_LIB`, dav1d for AV1 with `--features av1`), keyframes +/// where asked, timestamps kept, PSNR above 28 dB. +/// +/// Whatever hardware the machine has; skipped where none of it works. HEVC is +/// left out, having no decoder here. +#[test] +fn hardware_encoders_roundtrip() { + if ffmpeg().is_none() { + return; + } + let names: Vec<&'static str> = BACKENDS + .iter() + .filter(|b| b.is_hardware() && matches!(b.codec, Codec::H264 | Codec::Av1)) + .map(|b| b.name) + .filter(|name| available(name)) + .collect(); + if names.is_empty() { + eprintln!("no usable hardware encoder, skipped"); + return; + } + for name in &names { + roundtrip(name); + } + eprintln!("tested: {names:?}"); +} + #[test] fn x264_is_constrained_high_and_changes_size() { if ffmpeg().is_none() || !available("libx264") {