mirror of
https://github.com/orbbec/OrbbecSDK_ROS2.git
synced 2026-10-04 12:07:46 +08:00
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:
@@ -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()) {
|
||||
|
||||
Reference in New Issue
Block a user