@@ -51,9 +51,8 @@ mat3 update_calibration(Eigen::Matrix<float, 3, 4> &extrinsics, bool wide_camera
51
51
return matmul3 (yuv_transform, transform);
52
52
}
53
53
54
- uint64_t frame_id_from_ts (const VisionIpcBufExtra &extra) {
55
- uint64_t frame_ts = Hardware::TICI () ? extra.timestamp_sof : extra.timestamp_eof ;
56
- return (frame_ts + 25000000 ) / 50000000 ;
54
+ static uint64_t get_ts (const VisionIpcBufExtra &extra) {
55
+ return Hardware::TICI () ? extra.timestamp_sof : extra.timestamp_eof ;
57
56
}
58
57
59
58
@@ -80,11 +79,8 @@ void run_model(ModelState &model, VisionIpcClient &vipc_client_main, VisionIpcCl
80
79
VisionIpcBufExtra meta_extra = {0 };
81
80
82
81
while (!do_exit) {
83
- // TODO: change sync logic to use timestamp start of frame in case camerad skips a frame
84
- // log frame id in model packet
85
-
86
82
// Keep receiving frames until we are at least 1 frame ahead of previous extra frame
87
- while (frame_id_from_ts (meta_main) <= frame_id_from_ts (meta_extra)) {
83
+ while (get_ts (meta_main) < get_ts (meta_extra) + 25000000ULL ) {
88
84
buf_main = vipc_client_main.recv (&meta_main);
89
85
if (buf_main == nullptr ) break ;
90
86
}
@@ -98,7 +94,7 @@ void run_model(ModelState &model, VisionIpcClient &vipc_client_main, VisionIpcCl
98
94
// Keep receiving extra frames until frame id matches main camera
99
95
do {
100
96
buf_extra = vipc_client_extra.recv (&meta_extra);
101
- } while (buf_extra != nullptr && frame_id_from_ts (meta_main) > frame_id_from_ts (meta_extra));
97
+ } while (buf_extra != nullptr && get_ts (meta_main) > get_ts (meta_extra) + 25000000ULL );
102
98
103
99
if (buf_extra == nullptr ) {
104
100
LOGE (" vipc_client_extra no frame" );
0 commit comments