fix: 前后端时钟问题

This commit is contained in:
2026-04-18 16:07:28 +08:00
parent 557590f2bf
commit f49582536b
4 changed files with 56 additions and 20 deletions

View File

@@ -677,9 +677,9 @@ class NetworkTelemetryService:
d_to_b_video = _coerce_float(d_to_b_video_raw) if d_to_b_video_raw is not None else None
ack_estimate = self._control_ack_tracker.get_latest_estimate()
capture_to_send_raw = video_receiver_status.get("latest_capture_to_send_ms")
a_recv_to_paint_raw = display_probe_status.get("a_recv_to_paint_ms")
request_to_paint_raw = display_probe_status.get("request_to_paint_ms")
capture_to_send_ms = _coerce_float(capture_to_send_raw) if capture_to_send_raw is not None else None
a_recv_to_paint_ms = _coerce_float(a_recv_to_paint_raw) if a_recv_to_paint_raw is not None else None
request_to_paint_ms = _coerce_float(request_to_paint_raw) if request_to_paint_raw is not None else None
video_network_oneway_est_ms = (
round((a_to_d_video + d_to_b_video) / 2.0, 3)
if a_to_d_video is not None and d_to_b_video is not None
@@ -689,8 +689,8 @@ class NetworkTelemetryService:
if capture_to_send_ms is not None and video_network_oneway_est_ms is not None:
video_partial_est_ms = round(capture_to_send_ms + video_network_oneway_est_ms, 3)
video_e2e_est_ms = None
if video_partial_est_ms is not None and a_recv_to_paint_ms is not None:
video_e2e_est_ms = round(video_partial_est_ms + a_recv_to_paint_ms, 3)
if video_partial_est_ms is not None and request_to_paint_ms is not None:
video_e2e_est_ms = round(video_partial_est_ms + request_to_paint_ms, 3)
return {
"control_loop_rtt_ms": ack_estimate.get("control_loop_rtt_ms"),
@@ -710,7 +710,7 @@ class NetworkTelemetryService:
"video_e2e_est_ms": video_e2e_est_ms,
"estimate_method": {
"control": "ack_loop" if ack_estimate.get("ack_available") else "srtt_fallback",
"video": "capture_to_send+srtt/2+recv_to_paint" if video_e2e_est_ms is not None else "capture_to_send+srtt/2",
"video": "capture_to_send+srtt/2+request_to_paint" if video_e2e_est_ms is not None else "capture_to_send+srtt/2",
},
"clock_sync_required": False,
"assumptions": [