fix(sync): base startup grace on shared local pts
This commit is contained in:
parent
0eec6d0beb
commit
f8c48cd89c
6
Cargo.lock
generated
6
Cargo.lock
generated
@ -1642,7 +1642,7 @@ checksum = "09edd9e8b54e49e587e4f6295a7d29c3ea94d469cb40ab8ca70b288248a81db2"
|
||||
|
||||
[[package]]
|
||||
name = "lesavka_client"
|
||||
version = "0.14.8"
|
||||
version = "0.14.9"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"async-stream",
|
||||
@ -1676,7 +1676,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "lesavka_common"
|
||||
version = "0.14.8"
|
||||
version = "0.14.9"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"base64",
|
||||
@ -1688,7 +1688,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "lesavka_server"
|
||||
version = "0.14.8"
|
||||
version = "0.14.9"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"base64",
|
||||
|
||||
@ -4,7 +4,7 @@ path = "src/main.rs"
|
||||
|
||||
[package]
|
||||
name = "lesavka_client"
|
||||
version = "0.14.8"
|
||||
version = "0.14.9"
|
||||
edition = "2024"
|
||||
|
||||
[dependencies]
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "lesavka_common"
|
||||
version = "0.14.8"
|
||||
version = "0.14.9"
|
||||
edition = "2024"
|
||||
build = "build.rs"
|
||||
|
||||
|
||||
@ -10,7 +10,7 @@ bench = false
|
||||
|
||||
[package]
|
||||
name = "lesavka_server"
|
||||
version = "0.14.8"
|
||||
version = "0.14.9"
|
||||
edition = "2024"
|
||||
autobins = false
|
||||
|
||||
|
||||
@ -329,19 +329,6 @@ impl Relay for Handler {
|
||||
}
|
||||
continue;
|
||||
};
|
||||
if cold_startup_grace_pending && pkt.pts < startup_grace_us {
|
||||
let coalesced = retain_freshest_video_packet(&mut pending);
|
||||
tracing::debug!(
|
||||
rpc_id,
|
||||
session_id,
|
||||
pts = pkt.pts,
|
||||
startup_grace_us,
|
||||
dropped_pending = coalesced,
|
||||
"🎥 dropping cold-start upstream video until the relay warm-up grace is spent"
|
||||
);
|
||||
continue;
|
||||
}
|
||||
cold_startup_grace_pending = false;
|
||||
let plan = match upstream_media_rt.plan_video_pts(pkt.pts, frame_step_us) {
|
||||
lesavka_server::upstream_media_runtime::UpstreamPlanDecision::AwaitingPair => {
|
||||
pending.push_front(pkt);
|
||||
@ -352,6 +339,20 @@ impl Relay for Handler {
|
||||
}
|
||||
lesavka_server::upstream_media_runtime::UpstreamPlanDecision::Play(plan) => plan,
|
||||
};
|
||||
if cold_startup_grace_pending && plan.local_pts_us < startup_grace_us {
|
||||
let coalesced = retain_freshest_video_packet(&mut pending);
|
||||
tracing::debug!(
|
||||
rpc_id,
|
||||
session_id,
|
||||
remote_pts_us = pkt.pts,
|
||||
local_pts_us = plan.local_pts_us,
|
||||
startup_grace_us,
|
||||
dropped_pending = coalesced,
|
||||
"🎥 dropping startup video until the shared-session warm-up grace is spent"
|
||||
);
|
||||
continue;
|
||||
}
|
||||
cold_startup_grace_pending = false;
|
||||
if !upstream_media_rt
|
||||
.wait_for_audio_master(plan.local_pts_us, plan.due_at)
|
||||
.await
|
||||
|
||||
@ -215,11 +215,6 @@ impl Relay for Handler {
|
||||
}
|
||||
continue;
|
||||
};
|
||||
if cold_startup_grace_pending && pkt.pts < startup_grace_us {
|
||||
let _ = retain_freshest_video_packet(&mut pending);
|
||||
continue;
|
||||
}
|
||||
cold_startup_grace_pending = false;
|
||||
let plan = match upstream_media_rt.plan_video_pts(pkt.pts, frame_step_us) {
|
||||
lesavka_server::upstream_media_runtime::UpstreamPlanDecision::AwaitingPair => {
|
||||
pending.push_front(pkt);
|
||||
@ -230,6 +225,11 @@ impl Relay for Handler {
|
||||
}
|
||||
lesavka_server::upstream_media_runtime::UpstreamPlanDecision::Play(plan) => plan,
|
||||
};
|
||||
if cold_startup_grace_pending && plan.local_pts_us < startup_grace_us {
|
||||
let _ = retain_freshest_video_packet(&mut pending);
|
||||
continue;
|
||||
}
|
||||
cold_startup_grace_pending = false;
|
||||
if !upstream_media_rt
|
||||
.wait_for_audio_master(plan.local_pts_us, plan.due_at)
|
||||
.await
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user