From 96307b5e41b6886508237715de3c8832f95a0925 Mon Sep 17 00:00:00 2001 From: deanlee Date: Tue, 26 Jan 2021 12:21:55 +0800 Subject: [PATCH 1/2] rename create_thumbnail to publish_thumbnail --- selfdrive/camerad/cameras/camera_common.cc | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/selfdrive/camerad/cameras/camera_common.cc b/selfdrive/camerad/cameras/camera_common.cc index 00576198d4efe2..b350f53d4b2f91 100644 --- a/selfdrive/camerad/cameras/camera_common.cc +++ b/selfdrive/camerad/cameras/camera_common.cc @@ -237,7 +237,7 @@ void fill_frame_image(cereal::FrameData::Builder &framed, const CameraBuf *b) { delete[] resized_dat; } -static void create_thumbnail(MultiCameraState *s, const CameraBuf *b) { +static void publish_thumbnail(PubMaster *pm, const CameraBuf *b) { uint8_t* thumbnail_buffer = NULL; unsigned long thumbnail_len = 0; @@ -295,9 +295,7 @@ static void create_thumbnail(MultiCameraState *s, const CameraBuf *b) { thumbnaild.setTimestampEof(b->cur_frame_data.timestamp_eof); thumbnaild.setThumbnail(kj::arrayPtr((const uint8_t*)thumbnail_buffer, thumbnail_len)); - if (s->pm != NULL) { - s->pm->send("thumbnail", msg); - } + pm->send("thumbnail", msg); free(thumbnail_buffer); } @@ -350,7 +348,7 @@ void *processing_thread(MultiCameraState *cameras, const char *tname, if (cs == &(cameras->rear) && cnt % 100 == 3) { // this takes 10ms??? - create_thumbnail(cameras, &(cs->buf)); + publish_thumbnail(cameras->pm, &(cs->buf)); } cs->buf.release(); } From 75bebf3623ce027dcb6b36aeff2e159e07e8edb7 Mon Sep 17 00:00:00 2001 From: deanlee Date: Tue, 26 Jan 2021 22:10:47 +0800 Subject: [PATCH 2/2] check pm --- selfdrive/camerad/cameras/camera_common.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/selfdrive/camerad/cameras/camera_common.cc b/selfdrive/camerad/cameras/camera_common.cc index b350f53d4b2f91..ffcc84102e317b 100644 --- a/selfdrive/camerad/cameras/camera_common.cc +++ b/selfdrive/camerad/cameras/camera_common.cc @@ -346,7 +346,7 @@ void *processing_thread(MultiCameraState *cameras, const char *tname, callback(cameras, cs, cnt); - if (cs == &(cameras->rear) && cnt % 100 == 3) { + if (cs == &(cameras->rear) && cameras->pm && cnt % 100 == 3) { // this takes 10ms??? publish_thumbnail(cameras->pm, &(cs->buf)); }