From f4bf6a3dddd7dcfe4aac90ed596513e84a40a9c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Harald=20Sch=C3=A4fer?= Date: Sun, 11 Jun 2023 23:25:16 -0700 Subject: [PATCH] Encoderd: Give encoder threads good names (#28508) old-commit-hash: 5df4ac61d37334c568745d7b78e2853d48d481bb --- system/loggerd/encoderd.cc | 6 +++--- system/loggerd/loggerd.h | 5 ++++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/system/loggerd/encoderd.cc b/system/loggerd/encoderd.cc index 24d4dad2d9..b4f0b913e5 100644 --- a/system/loggerd/encoderd.cc +++ b/system/loggerd/encoderd.cc @@ -35,7 +35,7 @@ bool sync_encoders(EncoderdState *s, CameraType cam_type, uint32_t frame_id) { void encoder_thread(EncoderdState *s, const LogCameraInfo &cam_info) { - util::set_thread_name(cam_info.encoder_infos[0].filename); + util::set_thread_name(cam_info.thread_name); std::vector encoders; VisionIpcClient vipc_client = VisionIpcClient("camerad", cam_info.stream_type, false); @@ -50,7 +50,7 @@ void encoder_thread(EncoderdState *s, const LogCameraInfo &cam_info) { // init encoders if (encoders.empty()) { VisionBuf buf_info = vipc_client.buffers[0]; - LOGW("encoder %s init %dx%d", cam_info.encoder_infos[0].filename, buf_info.width, buf_info.height); + LOGW("encoder %s init %dx%d", cam_info.thread_name, buf_info.width, buf_info.height); if (buf_info.width > 0 && buf_info.height > 0) { for (const auto &encoder_info: cam_info.encoder_infos){ @@ -80,7 +80,7 @@ void encoder_thread(EncoderdState *s, const LogCameraInfo &cam_info) { // detect loop around and drop the frames if (buf->get_frame_id() != extra.frame_id) { if (!lagging) { - LOGE("encoder %s lag buffer id: %d extra id: %d", cam_info.encoder_infos[0].filename, buf->get_frame_id(), extra.frame_id); + LOGE("encoder %s lag buffer id: %d extra id: %d", cam_info.thread_name, buf->get_frame_id(), extra.frame_id); lagging = true; } continue; diff --git a/system/loggerd/loggerd.h b/system/loggerd/loggerd.h index 01aa5b434c..1333b72318 100644 --- a/system/loggerd/loggerd.h +++ b/system/loggerd/loggerd.h @@ -35,7 +35,6 @@ constexpr int MAIN_FPS = 20; const int MAIN_BITRATE = 10000000; -const int DCAM_BITRATE = MAIN_BITRATE; #define NO_CAMERA_PATIENCE 500 // fall back to time-based rotation if all cameras are dead @@ -56,6 +55,7 @@ public: class LogCameraInfo { public: + const char *thread_name; int fps = MAIN_FPS; CameraType type; VisionStreamType stream_type; @@ -87,18 +87,21 @@ 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}