Show what a watched stream delivers: size, frame rate, bitrate

A viewer could see the codec and the picture's size of a watched stream,
but not how many pictures arrived or at what bitrate, so a choppy or
starved stream looked like any other.

DecodeStats now counts the video bytes received and gives the decoded
frame rate and the received bitrate since the previous `stats()` call (at
least half a second; the watch screen asks once a second, other readers
share the same window). The watch screen shows "VP8 · 1280×720 · 30 fps ·
0.4 Mbit/s" in small text in the player's control bar, where a spacer was,
and in Stream Info.

These are read from the decoding pipeline, which runs in the app, rather
than sent as an engine event as planned: the engine never sees the decoded
pictures, and the screen already refreshes from these stats every second.

Tested: the local test pattern decodes at 20-40 fps and 0.1-5 Mbit/s
(media::tests::local_preview_decodes_the_pattern); a headless screenshot
of the watch screen with the sample stream showed the line.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
selikhovandClaude Opus 5.5 committed 2026-10-03 18:20:02 +03:00
1 parent 8d14b0d5be
commit 0bc96437e5
5 files changed
+65 -7

No files matched your search

+6 -1
View File
@@ -451,7 +451,8 @@ impl Decoder {
}
}
/// One line about the video: codec, size, problems.
/// One line about the video: codec, size, decoded frame rate, received
/// bitrate, problems.
pub fn info(&self) -> String {
let stats = self.stats();
let mut parts = Vec::new();
@@ -461,6 +462,10 @@ impl Decoder {
if stats.width > 0 {
parts.push(size_text(stats.width, stats.height));
}
if stats.decoded > 0 {
parts.push(format!("{} fps", stats.fps));
parts.push(format!("{:.1} Mbit/s", stats.bitrate as f64 / 1_000_000.0));
}
if let Some(e) = stats.error {
parts.push(e);
}