replay: fall back to qlog (#22362)

old-commit-hash: b7c64542f4b521e10725f34767079cd1f50f6496
This commit is contained in:
Willem Melching
2021-09-29 17:44:10 +02:00
committed by GitHub
parent 04e5fdb931
commit a3378ce0f7
2 changed files with 8 additions and 5 deletions
+7 -5
View File
@@ -182,9 +182,11 @@ Segment::Segment(int n, const SegmentFile &segment_files, bool load_dcam, bool l
if (!QDir(CACHE_DIR).exists()) QDir().mkdir(CACHE_DIR);
});
// fallback to qcamera
// fallback to qcamera/qlog
road_cam_path_ = files_.road_cam.isEmpty() ? files_.qcamera : files_.road_cam;
valid_ = !files_.rlog.isEmpty() && !road_cam_path_.isEmpty();
log_path_ = files_.rlog.isEmpty() ? files_.qlog : files_.rlog;
valid_ = !log_path_.isEmpty() && !road_cam_path_.isEmpty();
if (!valid_) return;
if (!load_dcam) {
@@ -194,8 +196,8 @@ Segment::Segment(int n, const SegmentFile &segment_files, bool load_dcam, bool l
files_.wide_road_cam = "";
}
if (!QUrl(files_.rlog).isLocalFile()) {
for (auto &url : {files_.rlog, road_cam_path_, files_.driver_cam, files_.wide_road_cam}) {
if (!QUrl(log_path_).isLocalFile()) {
for (auto &url : {log_path_, road_cam_path_, files_.driver_cam, files_.wide_road_cam}) {
if (!url.isEmpty() && !QFile::exists(localPath(url))) {
downloadFile(url);
++downloading_;
@@ -229,7 +231,7 @@ void Segment::load() {
std::vector<std::future<bool>> futures;
futures.emplace_back(std::async(std::launch::async, [=]() {
log = std::make_unique<LogReader>();
return log->load(localPath(files_.rlog).toStdString());
return log->load(localPath(log_path_).toStdString());
}));
QString camera_files[] = {road_cam_path_, files_.driver_cam, files_.wide_road_cam};
+1
View File
@@ -61,6 +61,7 @@ protected:
int seg_num_ = 0;
SegmentFile files_;
QString road_cam_path_;
QString log_path_;
std::vector<QThread*> download_threads_;
};