From 0681a415e9a162ebbbb70ba1e93ff7e268a58aa7 Mon Sep 17 00:00:00 2001 From: George Hotz <72895+geohot@users.noreply.github.com> Date: Sun, 10 Apr 2022 15:12:58 -0700 Subject: [PATCH] broadcast encode idx packets (#24176) Co-authored-by: Comma Device old-commit-hash: cc8430b66866ba127ac0d753cee9168240d23102 --- cereal | 2 +- selfdrive/loggerd/loggerd.cc | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/cereal b/cereal index aa52e6dfbe..ad317f1f49 160000 --- a/cereal +++ b/cereal @@ -1 +1 @@ -Subproject commit aa52e6dfbea1c6243ac5ec2085ef41c3f22398e8 +Subproject commit ad317f1f49ae1835d92c548f05d3b63a811f8600 diff --git a/selfdrive/loggerd/loggerd.cc b/selfdrive/loggerd/loggerd.cc index d402c5787f..57389508b4 100644 --- a/selfdrive/loggerd/loggerd.cc +++ b/selfdrive/loggerd/loggerd.cc @@ -46,6 +46,10 @@ void encoder_thread(LoggerdState *s, const LogCameraInfo &cam_info) { std::vector encoders; VisionIpcClient vipc_client = VisionIpcClient("camerad", cam_info.stream_type, false); + // While we write them right to the log for sync, we also publish the encode idx to the socket + const char *service_name = cam_info.type == DriverCam ? "driverEncodeIdx" : (cam_info.type == WideRoadCam ? "wideRoadEncodeIdx" : "roadEncodeIdx"); + PubMaster pm({service_name}); + while (!do_exit) { if (!vipc_client.connect(false)) { util::sleep_for(5); @@ -130,6 +134,7 @@ void encoder_thread(LoggerdState *s, const LogCameraInfo &cam_info) { auto bytes = msg.toBytes(); lh_log(lh, bytes.begin(), bytes.size(), true); } + pm.send(service_name, msg); } } @@ -191,6 +196,7 @@ void loggerd_thread() { // subscribe to all socks for (const auto& it : services) { if (!it.should_log) continue; + LOGD("logging %s (on port %d)", it.name, it.port); SubSocket * sock = SubSocket::create(ctx.get(), it.name); assert(sock != NULL);