Skip to content

Commit fded925

Browse files
committed
Add timeouts so missing/idle streams can't prevent LabRecorder from shutting down. Thanks to Jason Kowaleski (@kowalej)
1 parent dd199bc commit fded925

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

recording.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -373,14 +373,16 @@ void recording::typed_transfer_loop(streamid_t streamid, double srate, const inl
373373
std::vector<double> timestamps;
374374

375375
// Pull the first sample
376-
first_timestamp = last_timestamp = in->pull_sample(chunk);
376+
first_timestamp = 0.0;
377+
while(first_timestamp == 0.0)
378+
first_timestamp = last_timestamp = in->pull_sample(chunk, 4.0);
377379
timestamps.push_back(first_timestamp);
378380
file_.write_data_chunk(streamid, timestamps, chunk, in->get_channel_count());
379381

380382
auto next_pull = Clock::now();
381383
while (!shutdown_) {
382384
// get a chunk from the stream
383-
in->pull_chunk_multiplexed(chunk, &timestamps);
385+
in->pull_chunk_multiplexed(chunk, &timestamps, 4.0);
384386
// for each sample...
385387
for (double &ts : timestamps) {
386388
// if the time stamp can be deduced from the previous one...

0 commit comments

Comments
 (0)