fix(sync): drop startup-stale video until fresh
This commit is contained in:
parent
65e6f84f8d
commit
3bf53922bd
@ -4,7 +4,7 @@ path = "src/main.rs"
|
|||||||
|
|
||||||
[package]
|
[package]
|
||||||
name = "lesavka_client"
|
name = "lesavka_client"
|
||||||
version = "0.14.4"
|
version = "0.14.5"
|
||||||
edition = "2024"
|
edition = "2024"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "lesavka_common"
|
name = "lesavka_common"
|
||||||
version = "0.14.4"
|
version = "0.14.5"
|
||||||
edition = "2024"
|
edition = "2024"
|
||||||
build = "build.rs"
|
build = "build.rs"
|
||||||
|
|
||||||
|
|||||||
@ -10,7 +10,7 @@ bench = false
|
|||||||
|
|
||||||
[package]
|
[package]
|
||||||
name = "lesavka_server"
|
name = "lesavka_server"
|
||||||
version = "0.14.4"
|
version = "0.14.5"
|
||||||
edition = "2024"
|
edition = "2024"
|
||||||
autobins = false
|
autobins = false
|
||||||
|
|
||||||
|
|||||||
@ -279,6 +279,7 @@ impl Relay for Handler {
|
|||||||
let mut pending = std::collections::VecDeque::new();
|
let mut pending = std::collections::VecDeque::new();
|
||||||
let mut inbound_closed = false;
|
let mut inbound_closed = false;
|
||||||
let stale_drop_budget = upstream_stale_drop_budget();
|
let stale_drop_budget = upstream_stale_drop_budget();
|
||||||
|
let mut startup_video_settled = false;
|
||||||
loop {
|
loop {
|
||||||
if !camera_rt.is_active(session_id)
|
if !camera_rt.is_active(session_id)
|
||||||
|| !upstream_media_rt.is_camera_active(upstream_lease.generation)
|
|| !upstream_media_rt.is_camera_active(upstream_lease.generation)
|
||||||
@ -338,13 +339,26 @@ impl Relay for Handler {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if plan.late_by > stale_drop_budget {
|
if plan.late_by > stale_drop_budget {
|
||||||
tracing::warn!(
|
let coalesced = retain_freshest_video_packet(&mut pending);
|
||||||
rpc_id,
|
if startup_video_settled {
|
||||||
session_id,
|
tracing::warn!(
|
||||||
late_by_ms = plan.late_by.as_millis(),
|
rpc_id,
|
||||||
pts = plan.local_pts_us,
|
session_id,
|
||||||
"🎥 upstream video frame dropped after missing its freshness budget"
|
late_by_ms = plan.late_by.as_millis(),
|
||||||
);
|
pts = plan.local_pts_us,
|
||||||
|
dropped_pending = coalesced,
|
||||||
|
"🎥 upstream video frame dropped after missing its freshness budget"
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
tracing::debug!(
|
||||||
|
rpc_id,
|
||||||
|
session_id,
|
||||||
|
late_by_ms = plan.late_by.as_millis(),
|
||||||
|
pts = plan.local_pts_us,
|
||||||
|
dropped_pending = coalesced,
|
||||||
|
"🎥 dropping startup-stale upstream video until the playout window settles"
|
||||||
|
);
|
||||||
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
tokio::time::sleep_until(plan.due_at).await;
|
tokio::time::sleep_until(plan.due_at).await;
|
||||||
@ -352,16 +366,30 @@ impl Relay for Handler {
|
|||||||
.checked_duration_since(plan.due_at)
|
.checked_duration_since(plan.due_at)
|
||||||
.unwrap_or_default();
|
.unwrap_or_default();
|
||||||
if actual_late_by > stale_drop_budget {
|
if actual_late_by > stale_drop_budget {
|
||||||
tracing::warn!(
|
let coalesced = retain_freshest_video_packet(&mut pending);
|
||||||
rpc_id,
|
if startup_video_settled {
|
||||||
session_id,
|
tracing::warn!(
|
||||||
late_by_ms = actual_late_by.as_millis(),
|
rpc_id,
|
||||||
pts = plan.local_pts_us,
|
session_id,
|
||||||
"🎥 upstream video frame dropped after waking too late for fresh playout"
|
late_by_ms = actual_late_by.as_millis(),
|
||||||
);
|
pts = plan.local_pts_us,
|
||||||
|
dropped_pending = coalesced,
|
||||||
|
"🎥 upstream video frame dropped after waking too late for fresh playout"
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
tracing::debug!(
|
||||||
|
rpc_id,
|
||||||
|
session_id,
|
||||||
|
late_by_ms = actual_late_by.as_millis(),
|
||||||
|
pts = plan.local_pts_us,
|
||||||
|
dropped_pending = coalesced,
|
||||||
|
"🎥 dropping startup-stale upstream video after a late wake until the playout window settles"
|
||||||
|
);
|
||||||
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
pkt.pts = plan.local_pts_us;
|
pkt.pts = plan.local_pts_us;
|
||||||
|
startup_video_settled = true;
|
||||||
relay.feed(pkt); // ← all logging inside video.rs
|
relay.feed(pkt); // ← all logging inside video.rs
|
||||||
}
|
}
|
||||||
upstream_media_rt.close_camera(upstream_lease.generation);
|
upstream_media_rt.close_camera(upstream_lease.generation);
|
||||||
|
|||||||
@ -219,6 +219,7 @@ impl Relay for Handler {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if plan.late_by > stale_drop_budget {
|
if plan.late_by > stale_drop_budget {
|
||||||
|
let _ = retain_freshest_video_packet(&mut pending);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
tokio::time::sleep_until(plan.due_at).await;
|
tokio::time::sleep_until(plan.due_at).await;
|
||||||
@ -226,6 +227,7 @@ impl Relay for Handler {
|
|||||||
.checked_duration_since(plan.due_at)
|
.checked_duration_since(plan.due_at)
|
||||||
.unwrap_or_default();
|
.unwrap_or_default();
|
||||||
if actual_late_by > stale_drop_budget {
|
if actual_late_by > stale_drop_budget {
|
||||||
|
let _ = retain_freshest_video_packet(&mut pending);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
pkt.pts = plan.local_pts_us;
|
pkt.pts = plan.local_pts_us;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user