From 686787f33cb0c04ef6b23bb63ffa02a5c2fdb035 Mon Sep 17 00:00:00 2001 From: selikhov Date: Sat, 3 Oct 2026 23:34:40 +0300 Subject: [PATCH] Log once when the last decoder of a ladder keeps failing A stream no decoder here takes would otherwise warn every three failures for as long as it is watched; the first time says it all. Co-Authored-By: Claude Opus 5.5 --- crates/voelin-core/src/media.rs | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/crates/voelin-core/src/media.rs b/crates/voelin-core/src/media.rs index 6dd17b2..d11dc9a 100644 --- a/crates/voelin-core/src/media.rs +++ b/crates/voelin-core/src/media.rs @@ -2639,6 +2639,8 @@ struct ActiveDecoder { failures: u32, /// Frames taken since the last picture or failure. without_picture: u32, + /// It failed with no other decoder left (logged once). + last_failed: bool, } impl ActiveDecoder { @@ -2653,7 +2655,15 @@ impl ActiveDecoder { .map_or_else(|| format!("no decoder for {codec}"), |e| e.to_string()) }) })?; - Ok(Self { codec, backend, decoder, rest, failures: 0, without_picture: 0 }) + Ok(Self { + codec, + backend, + decoder, + rest, + failures: 0, + without_picture: 0, + last_failed: false, + }) } /// The next decoder of `rest` that opens; the last error if none did. @@ -2687,7 +2697,9 @@ impl ActiveDecoder { true } Err(_) => { - warn!(%codec, %failed, "the decoder fails ({reason}), and no other is left"); + if !std::mem::replace(&mut self.last_failed, true) { + warn!(%codec, %failed, "the decoder fails ({reason}), and no other is left"); + } false } }