fix race condition with encoder thread

old-commit-hash: e3d2f0c88cd04a2292ff4d90e74f38e147225d0c
This commit is contained in:
Adeeb Shihadeh
2021-01-05 23:09:46 -08:00
parent a342b68304
commit 84255f7c0d
+3 -1
View File
@@ -201,7 +201,6 @@ void encoder_thread(int cam_idx) {
VisionStream stream;
RotateState &rotate_state = s.rotate_state[cam_idx];
rotate_state.enabled = true;
std::vector<EncoderState*> encoders;
@@ -580,13 +579,16 @@ int main(int argc, char** argv) {
std::vector<std::thread> encoder_threads;
#ifndef DISABLE_ENCODER
encoder_threads.push_back(std::thread(encoder_thread, LOG_CAMERA_ID_FCAMERA));
s.rotate_state[LOG_CAMERA_ID_FCAMERA].enabled = true;
if (record_front) {
encoder_threads.push_back(std::thread(encoder_thread, LOG_CAMERA_ID_DCAMERA));
s.rotate_state[LOG_CAMERA_ID_DCAMERA].enabled = true;
}
#ifdef QCOM2
encoder_threads.push_back(std::thread(encoder_thread, LOG_CAMERA_ID_ECAMERA));
s.rotate_state[LOG_CAMERA_ID_ECAMERA].enabled = true;
#endif
#endif