feat(telemetry,ui): add PC pipeline latency, --gst-latency-trace & Glass-to-Glass stopwatch

This commit is contained in:
bleackstorm committed 2026-11-26 14:06:20 +01:00
1 parent 9f0c64f873
commit b24d4e0a27
9 files changed
+142 -8

No files matched your search

+14 -2
View File
@@ -667,6 +667,7 @@ pub fn compose_osd_and_publish(
has_new_raw_frame: bool,
has_video_stream: bool,
last_frame_id: u64,
frame_received_at: Option<Instant>,
fps_counter: &mut u32,
fps_timer: &mut Instant,
last_preview_push: &mut Option<Instant>,
@@ -801,8 +802,10 @@ pub fn compose_osd_and_publish(
let push_preview = ctx.control.is_preview_active()
&& last_preview_push.is_none_or(|t| t.elapsed() >= Duration::from_millis(33));
if push_preview || fps_timer.elapsed() >= Duration::from_secs(1) {
sync_video_status(ctx.cfg, ctx.video_rx_opt, &ctx.shared.monitor);
if push_preview || fps_timer.elapsed() >= Duration::from_secs(1) || frame_received_at.is_some() {
if push_preview || fps_timer.elapsed() >= Duration::from_secs(1) {
sync_video_status(ctx.cfg, ctx.video_rx_opt, &ctx.shared.monitor);
}
let preview_arc = if push_preview {
*last_preview_push = Some(Instant::now());
// Conversion directe RGBA -> BGRA sur le worker (zéro swizzle/clone sur le thread UI GPUI)
@@ -812,6 +815,14 @@ pub fn compose_osd_and_publish(
None
};
let mut mon = ctx.shared.monitor.lock();
if let Some(recv_at) = frame_received_at {
let eng_ms = recv_at.elapsed().as_secs_f32() * 1000.0;
mon.video_engine_latency_ms = if mon.video_engine_latency_ms <= 0.01 {
eng_ms
} else {
mon.video_engine_latency_ms * 0.8 + eng_ms * 0.2
};
}
if fps_timer.elapsed() >= Duration::from_secs(1) {
if has_video_stream {
mon.video_fps = *fps_counter as f32 / fps_timer.elapsed().as_secs_f32();
@@ -840,6 +851,7 @@ pub fn compose_osd_and_publish(
mon.preview_width = ctx.cfg.video_width;
mon.preview_height = ctx.cfg.video_height;
mon.preview_bgra = arc;
mon.preview_received_at = frame_received_at;
mon.preview_frame_seq = mon.preview_frame_seq.wrapping_add(1);
}
}