CI / Formatting, tests and builds (push) Failing after 1m29s
Un encodeur GStreamer derrière le trait VideoEncoder (fonctionnalité vaapi): appsrc BGRA, vapostproc vers NV12 sur le GPU, vah264lpenc ou vavp9lpenc, appsink. Un appel par image comme libvpx, sans image B, image clé sur demande. H.264 part en constrained baseline, mode 1, et rs-rtc le négocie; VP9 matériel garde la négociation existante. Sans greffon va, sans pilote ou réglage « Encoder sur la carte graphique » décoché, VP9 passe par libvpx et H.264 retombe en VP8, avec un avertissement. Une reprise ou un changement de source qui ne retrouverait pas le codec négocié est refusé. --software force libvpx en ligne de commande. Mesuré en 1080p30 dans Firefox: 17 % d'un cœur pour tout l'hôte au lieu de 80 % en VP8 logiciel, latence médiane 27 ms. 1080p60 tient à 26-35 %. Corrigé en chemin: la cadence adaptative partait de la première image, lente au démarrage d'un encodeur, et ne remontait plus; les dix premières images ne comptent plus. VP9 logiciel passe de 16 à 60 i/s. Le paquet Nix active vaapi et fournit le greffon et les pilotes VA-API de nixpkgs. Le contrôle des licences lit toutes les fonctionnalités. Décision dans l'ADR 0012, mesures dans docs/perf.md. Refs #57 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
66 lines
2.7 KiB
Bash
Executable File
66 lines
2.7 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# End-to-end latency and frame rate bench (#86).
|
|
#
|
|
# Starts rustscreen-cli on the synthetic test pattern (which stamps its capture
|
|
# instant into every frame), opens the session in a headless Firefox with the
|
|
# latency probe, and prints what the viewer measured plus the host's CPU use.
|
|
# Host and viewer run on this machine: one clock, no synchronisation needed.
|
|
#
|
|
# Usage: scripts/bench-latency.sh [WIDTHxHEIGHT] [quality: saver|balanced|sharp] [seconds]
|
|
# Environment:
|
|
# RUSTSCREEN_CLI binary to bench (default: target/release/rustscreen-cli)
|
|
# FIREFOX_PROFILE profile directory (snap Firefox: under ~/snap/firefox/common)
|
|
# BENCH_PORT host port (default 8199), MARIONETTE_PORT (default 2829)
|
|
# BENCH_ARGS extra rustscreen-cli options (`--codec vp9`, `--software`)
|
|
set -euo pipefail
|
|
|
|
size=${1:-1920x1080}
|
|
quality=${2:-sharp}
|
|
seconds=${3:-10}
|
|
root=$(cd "$(dirname "$0")/.." && pwd)
|
|
cli=${RUSTSCREEN_CLI:-$root/target/release/rustscreen-cli}
|
|
port=${BENCH_PORT:-8199}
|
|
marionette=${MARIONETTE_PORT:-2829}
|
|
work=$(mktemp -d)
|
|
profile=${FIREFOX_PROFILE:-$work/profile}
|
|
mkdir -p "$profile"
|
|
|
|
cleanup() {
|
|
[ -n "${host_pid:-}" ] && kill "$host_pid" 2>/dev/null || true
|
|
[ -n "${firefox_pid:-}" ] && kill "$firefox_pid" 2>/dev/null || true
|
|
rm -rf "$work"
|
|
}
|
|
trap cleanup EXIT
|
|
|
|
printf '{"version":1,"port":%s,"quality":"%s"}\n' "$port" "$quality" >"$work/settings.json"
|
|
cat >"$profile/user.js" <<PREFS
|
|
user_pref("marionette.port", $marionette);
|
|
user_pref("media.autoplay.default", 0);
|
|
user_pref("datareporting.policy.dataSubmissionEnabled", false);
|
|
PREFS
|
|
|
|
RUSTSCREEN_CONFIG="$work/settings.json" RUSTSCREEN_LOG_DIR="$work/logs" \
|
|
RUSTSCREEN_VIEWER="${RUSTSCREEN_VIEWER:-$root/apps/viewer/dist}" \
|
|
"$cli" --synthetic --size "$size" ${BENCH_ARGS:-} >"$work/host.log" 2>&1 &
|
|
host_pid=$!
|
|
firefox --headless --marionette --no-remote --profile "$profile" --window-size=1920,1200 about:blank \
|
|
>"$work/firefox.log" 2>&1 &
|
|
firefox_pid=$!
|
|
|
|
url=""
|
|
for _ in $(seq 100); do
|
|
url=$(grep -o 'http://[0-9.]*:[0-9]*/r/[^ ]*' "$work/host.log" | head -1 || true)
|
|
[ -n "$url" ] && ss -ltn | grep -q ":$marionette " && break
|
|
sleep 0.2
|
|
done
|
|
[ -n "$url" ] || { cat "$work/host.log" >&2; echo "the host did not start" >&2; exit 1; }
|
|
|
|
ticks() { awk '{print $14 + $15}' "/proc/$host_pid/stat"; }
|
|
hz=$(getconf CLK_TCK)
|
|
before=$(ticks)
|
|
result=$(node "$root/scripts/bench/latency.mjs" "$url" "$marionette" 3 "$seconds")
|
|
after=$(ticks)
|
|
# CPU over warmup and measurement, in percent of one core.
|
|
cpu=$(awk -v a="$before" -v b="$after" -v hz="$hz" -v s="$((seconds + 3))" 'BEGIN { printf "%.0f", (b - a) / hz / s * 100 }')
|
|
echo "{\"size\":\"$size\",\"quality\":\"$quality\",\"hostCpuPercent\":$cpu,\"viewer\":$result}"
|