diff --git a/selfdrive/ui/replay/filereader.cc b/selfdrive/ui/replay/filereader.cc index 5cb3b116a2..d110255497 100644 --- a/selfdrive/ui/replay/filereader.cc +++ b/selfdrive/ui/replay/filereader.cc @@ -52,7 +52,7 @@ std::string FileReader::download(const std::string &url, std::atomic *abor std::ostringstream oss; result.resize(remote_file_size); oss.rdbuf()->pubsetbuf(result.data(), result.size()); - int chunks = chunk_size_ > 0 ? std::min(1, (int)std::nearbyint(remote_file_size / (float)chunk_size_)) : 1; + int chunks = chunk_size_ > 0 ? std::max(1, (int)std::nearbyint(remote_file_size / (float)chunk_size_)) : 1; if (httpMultiPartDownload(url, oss, chunks, remote_file_size, abort)) { return result; } diff --git a/selfdrive/ui/replay/route.h b/selfdrive/ui/replay/route.h index 14289cc4f1..a77e8ad334 100644 --- a/selfdrive/ui/replay/route.h +++ b/selfdrive/ui/replay/route.h @@ -28,7 +28,7 @@ public: inline const QString &name() const { return route_.str; } inline const RouteIdentifier &identifier() const { return route_; } inline const std::map &segments() const { return segments_; } - inline const SegmentFile &at(int n) { return segments_.at(n); } + inline SegmentFile &at(int n) { return segments_.at(n); } static RouteIdentifier parseRoute(const QString &str); protected: diff --git a/selfdrive/ui/replay/tests/test_replay.cc b/selfdrive/ui/replay/tests/test_replay.cc index 6e2ec15a34..bda6da2670 100644 --- a/selfdrive/ui/replay/tests/test_replay.cc +++ b/selfdrive/ui/replay/tests/test_replay.cc @@ -57,9 +57,14 @@ TEST_CASE("FileReader") { } TEST_CASE("Segment") { + auto test_qlog = GENERATE(false, true); Route demo_route(DEMO_ROUTE); REQUIRE(demo_route.load()); REQUIRE(demo_route.segments().size() == 11); + if (test_qlog) { + demo_route.at(0).road_cam = ""; + demo_route.at(0).rlog = ""; + } QEventLoop loop; Segment segment(0, demo_route.at(0), false, false, false);