fixed CarParams write in replay (#24613)

* fixed CarParams write in replay

* need to capture temporary object

Co-authored-by: Shane Smiskol <shane@smiskol.com>
old-commit-hash: dc1a7bf082
taco
Jake Lynn 3 years ago committed by GitHub
parent 861bbaa62a
commit 7933015668
  1. 5
      selfdrive/ui/replay/replay.cc

@ -275,7 +275,10 @@ void Replay::startStream(const Segment *cur_segment) {
it = std::find_if(events.begin(), events.end(), [](auto e) { return e->which == cereal::Event::Which::CAR_PARAMS; }); it = std::find_if(events.begin(), events.end(), [](auto e) { return e->which == cereal::Event::Which::CAR_PARAMS; });
if (it != events.end()) { if (it != events.end()) {
car_fingerprint_ = (*it)->event.getCarParams().getCarFingerprint(); car_fingerprint_ = (*it)->event.getCarParams().getCarFingerprint();
auto bytes = (*it)->bytes(); capnp::MallocMessageBuilder builder;
builder.setRoot((*it)->event.getCarParams());
auto words = capnp::messageToFlatArray(builder);
auto bytes = words.asBytes();
Params().put("CarParams", (const char *)bytes.begin(), bytes.size()); Params().put("CarParams", (const char *)bytes.begin(), bytes.size());
} else { } else {
rWarning("failed to read CarParams from current segment"); rWarning("failed to read CarParams from current segment");

Loading…
Cancel
Save