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>
133 lines
3.9 KiB
JavaScript
133 lines
3.9 KiB
JavaScript
#!/usr/bin/env node
|
|
/**
|
|
* Every dependency shipped with rustscreen has a license compatible with
|
|
* Apache-2.0 (#59).
|
|
*
|
|
* Reads the Rust dependencies from `cargo metadata` (the main workspace, and
|
|
* the desktop shell with `--desktop`) and the viewer's runtime npm packages,
|
|
* which end up in the bundle. A license expression passes when one of its
|
|
* alternatives uses only accepted licenses: `MIT OR LGPL-2.1-or-later` passes
|
|
* through MIT. A missing or unknown license fails: it is a question to answer,
|
|
* not a default.
|
|
*
|
|
* MPL-2.0 is accepted: its copyleft covers the files of the library itself,
|
|
* shipped unmodified with their source upstream, not the code that uses them.
|
|
*
|
|
* Usage: node scripts/check-licenses.mjs [--desktop]
|
|
*/
|
|
import { execFileSync } from 'node:child_process';
|
|
import { readFileSync } from 'node:fs';
|
|
import { dirname, join } from 'node:path';
|
|
import { fileURLToPath } from 'node:url';
|
|
|
|
const root = join(dirname(fileURLToPath(import.meta.url)), '..');
|
|
|
|
const ACCEPTED = new Set([
|
|
'0BSD',
|
|
'Apache-2.0',
|
|
'Apache-2.0 WITH LLVM-exception',
|
|
'BSD-1-Clause',
|
|
'BSD-2-Clause',
|
|
'BSD-3-Clause',
|
|
'BSL-1.0',
|
|
'CC0-1.0',
|
|
'ISC',
|
|
'MIT',
|
|
'MIT-0',
|
|
'MPL-2.0',
|
|
'Unicode-3.0',
|
|
'Unicode-DFS-2016',
|
|
'Unlicense',
|
|
'Zlib',
|
|
]);
|
|
|
|
/** Is the SPDX expression satisfiable with accepted licenses only? */
|
|
export function accepted(expression) {
|
|
// Old crates write `MIT/Apache-2.0` for `MIT OR Apache-2.0`.
|
|
const tokens = expression
|
|
.replaceAll('/', ' OR ')
|
|
.replaceAll('(', ' ( ')
|
|
.replaceAll(')', ' ) ')
|
|
.split(/\s+/)
|
|
.filter(Boolean);
|
|
let at = 0;
|
|
const license = () => {
|
|
let id = tokens[at++];
|
|
if (tokens[at] === 'WITH') {
|
|
id = `${id} WITH ${tokens[at + 1]}`;
|
|
at += 2;
|
|
}
|
|
return ACCEPTED.has(id);
|
|
};
|
|
const primary = () => {
|
|
if (tokens[at] === '(') {
|
|
at++;
|
|
const value = or();
|
|
at++;
|
|
return value;
|
|
}
|
|
return license();
|
|
};
|
|
const and = () => {
|
|
let value = primary();
|
|
while (tokens[at] === 'AND') {
|
|
at++;
|
|
value = primary() && value;
|
|
}
|
|
return value;
|
|
};
|
|
const or = () => {
|
|
let value = and();
|
|
while (tokens[at] === 'OR') {
|
|
at++;
|
|
value = and() || value;
|
|
}
|
|
return value;
|
|
};
|
|
return tokens.length > 0 && or() && at === tokens.length;
|
|
}
|
|
|
|
function cargo(manifest) {
|
|
const out = execFileSync(
|
|
'cargo',
|
|
['metadata', '--format-version', '1', '--locked', '--all-features', '--manifest-path', manifest],
|
|
{ cwd: root, maxBuffer: 256 * 1024 * 1024 },
|
|
);
|
|
const metadata = JSON.parse(out);
|
|
const ours = new Set(metadata.workspace_members);
|
|
return metadata.packages
|
|
.filter((p) => !ours.has(p.id))
|
|
.map((p) => ({ name: `${p.name} ${p.version}`, license: p.license ?? '' }));
|
|
}
|
|
|
|
/** The viewer's runtime packages: what the bundle contains, not the build tools. */
|
|
function viewer() {
|
|
const dir = join(root, 'apps/viewer');
|
|
const seen = new Map();
|
|
const visit = (name) => {
|
|
if (seen.has(name)) return;
|
|
const manifest = JSON.parse(readFileSync(join(dir, 'node_modules', name, 'package.json')));
|
|
seen.set(name, { name: `${name} ${manifest.version}`, license: manifest.license ?? '' });
|
|
for (const dependency of Object.keys(manifest.dependencies ?? {})) visit(dependency);
|
|
};
|
|
const app = JSON.parse(readFileSync(join(dir, 'package.json')));
|
|
for (const dependency of Object.keys(app.dependencies ?? {})) visit(dependency);
|
|
return [...seen.values()];
|
|
}
|
|
|
|
function main() {
|
|
const packages = [...cargo('Cargo.toml'), ...viewer()];
|
|
if (process.argv.includes('--desktop')) {
|
|
packages.push(...cargo('apps/desktop/src-tauri/Cargo.toml'));
|
|
}
|
|
const refused = packages.filter((p) => !accepted(p.license));
|
|
if (refused.length > 0) {
|
|
for (const p of refused) console.error(`${p.name}: "${p.license || 'no license'}"`);
|
|
console.error(`\n${refused.length} dependencies without a license compatible with Apache-2.0`);
|
|
process.exit(1);
|
|
}
|
|
console.log(`licenses checked: ${packages.length} dependencies compatible with Apache-2.0`);
|
|
}
|
|
|
|
if (process.argv[1] === fileURLToPath(import.meta.url)) main();
|