From e49dd50f98330817bc89ff66815b54dbc57ad992 Mon Sep 17 00:00:00 2001 From: Willem Melching Date: Wed, 1 Sep 2021 23:08:06 -0700 Subject: [PATCH] Disable encoder sync logic if only one rotate camera present (#22107) * disable sync logic if only one rotate camera * consistent brackets old-commit-hash: 48035e9535ba362e382d01282a1475b4ace2778a --- selfdrive/loggerd/loggerd.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/selfdrive/loggerd/loggerd.cc b/selfdrive/loggerd/loggerd.cc index 1b9e9d6db6..2634c69fea 100644 --- a/selfdrive/loggerd/loggerd.cc +++ b/selfdrive/loggerd/loggerd.cc @@ -159,7 +159,7 @@ void encoder_thread(const LogCameraInfo &cam_info) { VisionBuf* buf = vipc_client.recv(&extra); if (buf == nullptr) continue; - if (cam_info.trigger_rotate) { + if (cam_info.trigger_rotate && (s.max_waiting > 1)) { if (!ready) { LOGE("%s encoder ready", cam_info.filename); ++s.encoders_ready; @@ -176,7 +176,9 @@ void encoder_thread(const LogCameraInfo &cam_info) { continue; } } + } + if (cam_info.trigger_rotate) { s.last_camera_seen_tms = millis_since_boot(); } @@ -340,7 +342,7 @@ int main(int argc, char** argv) { double start_ts = millis_since_boot(); while (!do_exit) { // Check if all encoders are ready and start encoding at the same time - if (!s.encoders_synced && (s.encoders_ready == s.max_waiting)) { + if ((s.max_waiting > 1) && !s.encoders_synced && (s.encoders_ready == s.max_waiting)) { // Small margin in case one of the encoders already dropped the next frame s.start_frame_id = s.latest_frame_id + 2; s.encoders_synced = true;