Merge claude/gifted-lovelace-1crlx2 (the decoders) into the negotiation work
The development branch gained FFmpeg's decoders and the decoder ladder. Conflicts only in text: the changelog keeps both entries, media.md the H.264 profile ladder next to the new VideoPipeline description, the interop README both sets of Chromium findings, and browser_codecs.rs both the per-format viewer sink and the new pipeline test. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
commit
a990b7c49b
29 files changed
+2753
-157
No files matched your search
@@ -12,7 +12,9 @@ use clap::{Args, Subcommand};
|
||||
use voelin_core::media::voelin_media::capture::SourceId;
|
||||
use voelin_core::media::voelin_media::capture::synthetic::Pattern;
|
||||
use voelin_core::media::voelin_media::{Codec, Codecs};
|
||||
use voelin_core::media::{EncoderPreference, MediaSink, Streamer, StreamerConfig, preferred_codec};
|
||||
use voelin_core::media::{
|
||||
DecoderPreference, EncoderPreference, MediaSink, Streamer, StreamerConfig, preferred_codec,
|
||||
};
|
||||
use voelin_stream::{EncodedFrame, LayerId, LayerSet, LayerSpec, MediaKind};
|
||||
|
||||
use crate::alloc;
|
||||
@@ -29,9 +31,10 @@ enum StreamTool {
|
||||
/// test pattern without a server; print per-stage and per-layer numbers
|
||||
/// and heap allocations per frame.
|
||||
Bench(BenchArgs),
|
||||
/// List the video encoders: the FFmpeg libraries found, every backend
|
||||
/// with its self-test result (or why it cannot be used), and the order
|
||||
/// the streamer would use them in.
|
||||
/// List the video encoders and decoders: the FFmpeg libraries found,
|
||||
/// every backend with its self-test result (or why it cannot be used),
|
||||
/// the order the streamer would use the encoders in, and each codec's
|
||||
/// decoders in the order a viewer tries them.
|
||||
Encoders(EncodersArgs),
|
||||
}
|
||||
|
||||
@@ -44,6 +47,12 @@ struct EncodersArgs {
|
||||
/// Rank without hardware encoders (`stream.hardware_acceleration` off).
|
||||
#[arg(long)]
|
||||
no_hardware: bool,
|
||||
/// Decoder choice to rank by (as the setting `stream.decoder_backend`).
|
||||
#[arg(long, default_value = "auto")]
|
||||
decoder: String,
|
||||
/// Rank without hardware decoders (`stream.hardware_decoding` off).
|
||||
#[arg(long)]
|
||||
no_hardware_decoding: bool,
|
||||
/// Cisco's OpenH264 library, to list it as well.
|
||||
#[arg(long)]
|
||||
openh264: Option<PathBuf>,
|
||||
@@ -127,7 +136,11 @@ fn codecs_for(encoder: &str, no_hardware: bool, openh264: Option<&PathBuf>) -> R
|
||||
}
|
||||
|
||||
fn encoders(args: EncodersArgs) -> Result<()> {
|
||||
let codecs = codecs_for(&args.encoder, args.no_hardware, args.openh264.as_ref())?;
|
||||
let codecs = codecs_for(&args.encoder, args.no_hardware, args.openh264.as_ref())?
|
||||
.with_decoder_preference(DecoderPreference {
|
||||
hardware: !args.no_hardware_decoding,
|
||||
backend: args.decoder.parse().unwrap_or_default(),
|
||||
});
|
||||
let report = codecs.report();
|
||||
match &report.ffmpeg {
|
||||
Ok(text) => println!("{text}"),
|
||||
@@ -160,6 +173,27 @@ fn encoders(args: EncodersArgs) -> Result<()> {
|
||||
let order: Vec<String> =
|
||||
codecs.encoders().iter().map(|(codec, backend)| format!("{codec} {backend}")).collect();
|
||||
println!("\nstreamer order: {}", order.join(", "));
|
||||
println!();
|
||||
println!("{:<18} {:<5} {:<17} {:<8} {:<5} status", "decoder", "codec", "api", "kind", "rank");
|
||||
let mut list = report.decoders.clone();
|
||||
list.sort_by_key(|d| (d.status.is_err(), d.codec.name(), d.rank.unwrap_or(usize::MAX)));
|
||||
for d in &list {
|
||||
println!(
|
||||
"{:<18} {:<5} {:<17} {:<8} {:<5} {}",
|
||||
d.name,
|
||||
d.codec.name(),
|
||||
d.api,
|
||||
if d.hardware { "hardware" } else { "software" },
|
||||
d.rank.map_or("-".to_owned(), |r| r.to_string()),
|
||||
d.status.as_ref().err().map_or("ok", String::as_str),
|
||||
);
|
||||
}
|
||||
println!("\nviewer order (each codec's decoders, best first):");
|
||||
for codec in codecs.decoders() {
|
||||
let ladder: Vec<String> =
|
||||
codecs.decoders_for(codec).iter().map(|b| b.to_string()).collect();
|
||||
println!(" {codec}: {}", ladder.join(" > "));
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
||||
@@ -817,7 +817,7 @@ async fn watch(
|
||||
);
|
||||
let mut tick = tokio::time::interval(Duration::from_millis(100));
|
||||
let mut first_picture = true;
|
||||
let mut last_picture: Option<VideoFrame> = None;
|
||||
let mut last_picture: Option<Arc<VideoFrame>> = None;
|
||||
let summary = |video: u64, audio: u64, decoder: &VideoPipeline| {
|
||||
let stats = decoder.stats();
|
||||
println!(
|
||||
@@ -826,7 +826,7 @@ async fn watch(
|
||||
stats.error.map(|e| format!(" (last error: {e})")).unwrap_or_default()
|
||||
);
|
||||
};
|
||||
let save_last = |last: &Option<VideoFrame>| -> Result<()> {
|
||||
let save_last = |last: &Option<Arc<VideoFrame>>| -> Result<()> {
|
||||
match (save, last) {
|
||||
(Some(path), Some(picture)) => {
|
||||
save_png(picture, path)?;
|
||||
|
||||
Reference in new issue
Block a user