Skip to content

Commit f181eb8

Browse files
allow for unlimited recording
1 parent f20b3c4 commit f181eb8

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

data_tamer_cpp/include/data_tamer/sinks/mcap_sink.hpp

+4-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class MCAPSink : public DataSinkBase
2525
* @brief MCAPSink.
2626
* IMPORTANT: if you want the recorder to be more robust to crash/segfault,
2727
* set `do_compression` to false.
28-
* Compression is dafe if your application is closing cleanly.
28+
* Compression is safe if your application is closing cleanly.
2929
*
3030
* @param filepath path of the file to be saved. Should have extension ".mcap"
3131
* @param do_compression if true, compress the data on the fly.
@@ -40,6 +40,8 @@ class MCAPSink : public DataSinkBase
4040

4141
/// After a certain amount of time, the MCAP file will be reset
4242
/// and overwritten. Default value is 600 seconds (10 minutes)
43+
/// To disable this feature, use a time of 0 seconds.
44+
/// WARNING: this can consume a large amount of disk space very quickly.
4345
void setMaxTimeBeforeReset(std::chrono::seconds reset_time);
4446

4547
/// Stop recording and save the file
@@ -67,6 +69,7 @@ class MCAPSink : public DataSinkBase
6769
std::chrono::system_clock::time_point start_time_;
6870

6971
bool forced_stop_recording_ = false;
72+
bool unlimited_recording_ = false;
7073
std::recursive_mutex mutex_;
7174

7275
void openFile(std::string const& filepath);

data_tamer_cpp/src/sinks/mcap_sink.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#include "data_tamer/sinks/mcap_sink.hpp"
22
#include "data_tamer/contrib/SerializeMe.hpp"
33

4+
#include <chrono>
45
#include <sstream>
56
#include <mutex>
67

@@ -118,7 +119,7 @@ bool MCAPSink::storeSnapshot(const Snapshot& snapshot)
118119
// If reset_time_ is exceeded, we want to overwrite the current file.
119120
// Better than filling the disk, if you forgot to stop the application.
120121
auto const now = std::chrono::system_clock::now();
121-
if(now - start_time_ > reset_time_)
122+
if(reset_time_ != std::chrono::seconds(0) && now - start_time_ > reset_time_)
122123
{
123124
restartRecording(filepath_, compression_);
124125
}

0 commit comments

Comments
 (0)