diff --git a/system/camerad/cameras/camera_common.h b/system/camerad/cameras/camera_common.h index d1f0b0d0e..0536ecc7f 100644 --- a/system/camerad/cameras/camera_common.h +++ b/system/camerad/cameras/camera_common.h @@ -11,12 +11,6 @@ const int YUV_BUFFER_COUNT = 20; -enum CameraType { - RoadCam = 0, - DriverCam, - WideRoadCam -}; - // for debugging const bool env_debug_frames = getenv("DEBUG_FRAMES") != NULL; const bool env_log_raw_frames = getenv("LOG_RAW_FRAMES") != NULL; diff --git a/system/loggerd/encoder/encoder.h b/system/loggerd/encoder/encoder.h index 96ad4ffeb..1296f78f6 100644 --- a/system/loggerd/encoder/encoder.h +++ b/system/loggerd/encoder/encoder.h @@ -17,7 +17,6 @@ #include "cereal/messaging/messaging.h" #include "msgq/visionipc/visionipc.h" #include "common/queue.h" -#include "system/camerad/cameras/camera_common.h" #include "system/loggerd/loggerd.h" class VideoEncoder { diff --git a/system/loggerd/encoderd.cc b/system/loggerd/encoderd.cc index 1b45df682..4186e13ef 100644 --- a/system/loggerd/encoderd.cc +++ b/system/loggerd/encoderd.cc @@ -18,12 +18,12 @@ struct EncoderdState { // Sync logic for startup std::atomic encoders_ready = 0; std::atomic start_frame_id = 0; - bool camera_ready[WideRoadCam + 1] = {}; - bool camera_synced[WideRoadCam + 1] = {}; + bool camera_ready[VISION_STREAM_WIDE_ROAD + 1] = {}; + bool camera_synced[VISION_STREAM_WIDE_ROAD + 1] = {}; }; // Handle initial encoder syncing by waiting for all encoders to reach the same frame id -bool sync_encoders(EncoderdState *s, CameraType cam_type, uint32_t frame_id) { +bool sync_encoders(EncoderdState *s, VisionStreamType cam_type, uint32_t frame_id) { if (s->camera_synced[cam_type]) return true; if (s->max_waiting > 1 && s->encoders_ready != s->max_waiting) { @@ -85,7 +85,7 @@ void encoder_thread(EncoderdState *s, const LogCameraInfo &cam_info) { } lagging = false; - if (!sync_encoders(s, cam_info.type, extra.frame_id)) { + if (!sync_encoders(s, cam_info.stream_type, extra.frame_id)) { continue; } if (do_exit) break; diff --git a/system/loggerd/loggerd.h b/system/loggerd/loggerd.h index 7c80ba51a..e8cdadda0 100644 --- a/system/loggerd/loggerd.h +++ b/system/loggerd/loggerd.h @@ -5,7 +5,6 @@ #include "cereal/messaging/messaging.h" #include "cereal/services.h" #include "msgq/visionipc/visionipc_client.h" -#include "system/camerad/cameras/camera_common.h" #include "system/hardware/hw.h" #include "common/params.h" #include "common/swaglog.h" @@ -51,7 +50,6 @@ class LogCameraInfo { public: const char *thread_name; int fps = MAIN_FPS; - CameraType type; VisionStreamType stream_type; std::vector encoder_infos; }; @@ -112,42 +110,36 @@ const EncoderInfo qcam_encoder_info = { const LogCameraInfo road_camera_info{ .thread_name = "road_cam_encoder", - .type = RoadCam, .stream_type = VISION_STREAM_ROAD, .encoder_infos = {main_road_encoder_info, qcam_encoder_info} }; const LogCameraInfo wide_road_camera_info{ .thread_name = "wide_road_cam_encoder", - .type = WideRoadCam, .stream_type = VISION_STREAM_WIDE_ROAD, .encoder_infos = {main_wide_road_encoder_info} }; const LogCameraInfo driver_camera_info{ .thread_name = "driver_cam_encoder", - .type = DriverCam, .stream_type = VISION_STREAM_DRIVER, .encoder_infos = {main_driver_encoder_info} }; const LogCameraInfo stream_road_camera_info{ .thread_name = "road_cam_encoder", - .type = RoadCam, .stream_type = VISION_STREAM_ROAD, .encoder_infos = {stream_road_encoder_info} }; const LogCameraInfo stream_wide_road_camera_info{ .thread_name = "wide_road_cam_encoder", - .type = WideRoadCam, .stream_type = VISION_STREAM_WIDE_ROAD, .encoder_infos = {stream_wide_road_encoder_info} }; const LogCameraInfo stream_driver_camera_info{ .thread_name = "driver_cam_encoder", - .type = DriverCam, .stream_type = VISION_STREAM_DRIVER, .encoder_infos = {stream_driver_encoder_info} }; diff --git a/tools/replay/framereader.h b/tools/replay/framereader.h index 7a4d024aa..03ea5be8b 100644 --- a/tools/replay/framereader.h +++ b/tools/replay/framereader.h @@ -4,8 +4,8 @@ #include #include "msgq/visionipc/visionbuf.h" -#include "system/camerad/cameras/camera_common.h" #include "tools/replay/filereader.h" +#include "tools/replay/util.h" extern "C" { #include diff --git a/tools/replay/logreader.h b/tools/replay/logreader.h index ab35954db..f8d60ffad 100644 --- a/tools/replay/logreader.h +++ b/tools/replay/logreader.h @@ -4,7 +4,6 @@ #include #include "cereal/gen/cpp/log.capnp.h" -#include "system/camerad/cameras/camera_common.h" #include "tools/replay/util.h" const CameraType ALL_CAMERAS[] = {RoadCam, DriverCam, WideRoadCam}; diff --git a/tools/replay/util.h b/tools/replay/util.h index c3b016c39..d6c26a347 100644 --- a/tools/replay/util.h +++ b/tools/replay/util.h @@ -4,6 +4,13 @@ #include #include #include +#include "cereal/messaging/messaging.h" + +enum CameraType { + RoadCam = 0, + DriverCam, + WideRoadCam +}; enum class ReplyMsgType { Info,