mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-07-12 21:02:13 +08:00
replay: fix qcam download error (#22777)
* fix qcam download error * test loading qlog/qcamera old-commit-hash: 79651b6c4917415c11d1b462a87e1e18853d6e68
This commit is contained in:
@@ -52,7 +52,7 @@ std::string FileReader::download(const std::string &url, std::atomic<bool> *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;
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ public:
|
||||
inline const QString &name() const { return route_.str; }
|
||||
inline const RouteIdentifier &identifier() const { return route_; }
|
||||
inline const std::map<int, SegmentFile> &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:
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user