From 12b4f9aa4fc66e3fd29ebe3a7000a79ea93fa655 Mon Sep 17 00:00:00 2001 From: Rick Lan Date: Sun, 22 Nov 2020 17:41:38 +1000 Subject: [PATCH] bug fixes --- selfdrive/camerad/cameras/camera_common.h | 7 +++++++ selfdrive/camerad/main.cc | 1 + selfdrive/common/visionipc.h | 1 + 3 files changed, 9 insertions(+) diff --git a/selfdrive/camerad/cameras/camera_common.h b/selfdrive/camerad/cameras/camera_common.h index d395241e9..fc5fa229d 100644 --- a/selfdrive/camerad/cameras/camera_common.h +++ b/selfdrive/camerad/cameras/camera_common.h @@ -1,5 +1,6 @@ #pragma once +#include #include #include #include @@ -34,6 +35,10 @@ #define LOG_CAMERA_ID_QCAMERA 3 #define LOG_CAMERA_ID_MAX 4 +const bool env_send_front = getenv("SEND_FRONT") != NULL; +const bool env_send_rear = getenv("SEND_REAR") != NULL; +const bool env_send_wide = getenv("SEND_WIDE") != NULL; + typedef struct CameraInfo { const char* name; int frame_width, frame_height; @@ -58,6 +63,7 @@ typedef struct LogCameraInfo { typedef struct FrameMetadata { uint32_t frame_id; + uint64_t timestamp_sof; // only set on tici uint64_t timestamp_eof; unsigned int frame_length; unsigned int integ_lines; @@ -128,6 +134,7 @@ public: typedef void (*process_thread_cb)(MultiCameraState *s, CameraState *c, int cnt); void fill_frame_data(cereal::FrameData::Builder &framed, const FrameMetadata &frame_data, uint32_t cnt); +void fill_frame_image(cereal::FrameData::Builder &framed, uint8_t *dat, int w, int h, int stride); void create_thumbnail(MultiCameraState *s, CameraState *c, uint8_t *bgr_ptr); void set_exposure_target(CameraState *c, const uint8_t *pix_ptr, int x_start, int x_end, int x_skip, int y_start, int y_end, int y_skip); std::thread start_process_thread(MultiCameraState *cameras, const char *tname, diff --git a/selfdrive/camerad/main.cc b/selfdrive/camerad/main.cc index 712a08809..4809315df 100644 --- a/selfdrive/camerad/main.cc +++ b/selfdrive/camerad/main.cc @@ -205,6 +205,7 @@ void* visionserver_client_thread(void* arg) { stream_i == VISION_STREAM_YUV_WIDE) { CameraBuf *b = get_camerabuf_by_type(s, (VisionStreamType)stream_i); rep.d.stream_acq.extra.frame_id = b->yuv_metas[idx].frame_id; + rep.d.stream_acq.extra.timestamp_sof = b->yuv_metas[idx].timestamp_sof; rep.d.stream_acq.extra.timestamp_eof = b->yuv_metas[idx].timestamp_eof; } vipc_send(fd, &rep); diff --git a/selfdrive/common/visionipc.h b/selfdrive/common/visionipc.h index 1b216f525..e20500db6 100644 --- a/selfdrive/common/visionipc.h +++ b/selfdrive/common/visionipc.h @@ -57,6 +57,7 @@ typedef struct VisionStreamBufs { typedef struct VIPCBufExtra { // only for yuv uint32_t frame_id; + uint64_t timestamp_sof; uint64_t timestamp_eof; } VIPCBufExtra;