diff --git a/applications/reconstruct/src/main.cpp b/applications/reconstruct/src/main.cpp index c2f357e187e99c04c190df448346b1954d9e95a9..52d9b603e46d2010304f8fced88006efa487e91c 100644 --- a/applications/reconstruct/src/main.cpp +++ b/applications/reconstruct/src/main.cpp @@ -159,12 +159,12 @@ static void run(ftl::Configurable *root) { group.addSource(in); } - stream->setLatency(4); // FIXME: This depends on source!? + stream->setLatency(5); // FIXME: This depends on source!? stream->run(); bool busy = false; - group.setLatency(4); + group.setLatency(5); group.setName("ReconGroup"); group.sync([splat,virt,&busy,&slave,&scene_A,&scene_B,&align](ftl::rgbd::FrameSet &fs) -> bool { //cudaSetDevice(scene->getCUDADevice()); diff --git a/components/rgbd-sources/src/net.cpp b/components/rgbd-sources/src/net.cpp index ba485c9402d888be0636902f3962cce2dd1e85ed..4f1f5b1419f0bbf581be0ae178b843029f5fe284 100644 --- a/components/rgbd-sources/src/net.cpp +++ b/components/rgbd-sources/src/net.cpp @@ -40,6 +40,8 @@ NetFrame &NetFrameQueue::getFrame(int64_t ts, const cv::Size &s, int c1type, int if (f.timestamp == ts) return f; } + int64_t oldest = ts; + // No match so find an empty slot for (auto &f : frames_) { if (f.timestamp == -1) { @@ -51,11 +53,23 @@ NetFrame &NetFrameQueue::getFrame(int64_t ts, const cv::Size &s, int c1type, int f.channel2.create(s, c2type); return f; } + oldest = (f.timestamp < oldest) ? f.timestamp : oldest; } // No empty slot, so give a fatal error for (auto &f : frames_) { LOG(ERROR) << "Stale frame: " << f.timestamp << " - " << f.chunk_count; + + // Force release of frame! + if (f.timestamp == oldest) { + f.timestamp = ts; + f.chunk_count = 0; + f.chunk_total = 0; + f.tx_size = 0; + f.channel1.create(s, c1type); + f.channel2.create(s, c2type); + return f; + } } LOG(FATAL) << "Net Frame Queue not large enough: " << ts; // FIXME: (Nick) Could auto resize the queue.