From 6d3dc46b8ff9046c507c57fa1c60e7f68cb95914 Mon Sep 17 00:00:00 2001 From: ZwX1616 Date: Mon, 5 Oct 2020 15:41:17 -0700 Subject: [PATCH] transient considerations (#2276) old-commit-hash: 55351859a73f412fdd52b2166298f9ed354ce6c1 --- 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 687c9cfb83..bbd1aa1f4a 100644 --- a/selfdrive/loggerd/loggerd.cc +++ b/selfdrive/loggerd/loggerd.cc @@ -232,7 +232,6 @@ void encoder_thread(RotateState *rotate_state, bool is_streaming, bool raw_clips int encoder_segment = -1; int cnt = 0; - rotate_state->enabled = true; pthread_mutex_lock(&s.rotate_lock); int my_idx = s.num_encoder; s.num_encoder += 1; @@ -683,14 +682,17 @@ int main(int argc, char** argv) { #ifndef DISABLE_ENCODER // rear camera std::thread encoder_thread_handle(encoder_thread, &s.rotate_state[LOG_CAMERA_ID_FCAMERA], is_streaming, false, LOG_CAMERA_ID_FCAMERA); + s.rotate_state[LOG_CAMERA_ID_FCAMERA].enabled = true; // front camera std::thread front_encoder_thread_handle; if (record_front) { front_encoder_thread_handle = std::thread(encoder_thread, &s.rotate_state[LOG_CAMERA_ID_DCAMERA], false, false, LOG_CAMERA_ID_DCAMERA); + s.rotate_state[LOG_CAMERA_ID_DCAMERA].enabled = true; } #ifdef QCOM2 // wide camera std::thread wide_encoder_thread_handle(encoder_thread, &s.rotate_state[LOG_CAMERA_ID_ECAMERA], false, false, LOG_CAMERA_ID_ECAMERA); + s.rotate_state[LOG_CAMERA_ID_ECAMERA].enabled = true; #endif #endif @@ -770,7 +772,7 @@ int main(int argc, char** argv) { for (int cid=0;cid<=MAX_CAM_IDX;cid++) { // this *should* be redundant on tici since all camera frames are synced new_segment &= (((s.rotate_state[cid].stream_frame_id >= s.rotate_state[cid].last_rotate_frame_id + segment_length * MAIN_FPS) && - (!s.rotate_state[cid].should_rotate)) || + (!s.rotate_state[cid].should_rotate) && (s.rotate_state[cid].last_rotate_frame_id != UINT32_MAX)) || (!s.rotate_state[cid].enabled)); if (last_seen_log_frame_id[cid] + 2 < last_seen_log_frame_id_max) { LOGW("camera %d lags behind", cid); } #ifndef QCOM2