transient considerations (#2276)

This commit is contained in:
ZwX1616 2020-10-05 15:41:17 -07:00 committed by GitHub
parent 21d4ac1eeb
commit 55351859a7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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