fix: sort completed rows by row_id before writing CSV

Sort completed rows in the writer thread so the CSV is always written in
frame arrival order, even when color and depth frames complete concurrently
on separate threads.
This commit is contained in:
slz
2026-08-12 11:05:37 +08:00
parent 61ee663864
commit eda99faf42
@@ -572,6 +572,9 @@ void FrameTimestampCsvLogger::writerThreadMain() {
rows_to_write.swap(completed_rows_);
}
std::stable_sort(rows_to_write.begin(), rows_to_write.end(),
[](const auto &lhs, const auto &rhs) { return lhs.row_id < rhs.row_id; });
for (const auto &row : rows_to_write) {
if (csv_rows_written_ >= kMaxCsvRowsPerFileIncludingHeader) {
if (!rotateCsvFile()) {