From d178b862cdc66fad8aaea93b4a0fa45fe0a4af69 Mon Sep 17 00:00:00 2001
From: Nicolas Pope <nwpope@utu.fi>
Date: Sun, 18 Aug 2019 14:09:44 +0300
Subject: [PATCH] Check for bad frame timestamps

---
 components/rgbd-sources/src/net.cpp | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/components/rgbd-sources/src/net.cpp b/components/rgbd-sources/src/net.cpp
index 8fcb95a17..86fa08a2b 100644
--- a/components/rgbd-sources/src/net.cpp
+++ b/components/rgbd-sources/src/net.cpp
@@ -220,12 +220,13 @@ void NetSource::_recvChunk(int64_t ts, int chunk, bool delta, const vector<unsig
 			// Silent ignore?
 		}
 	}
-		
-	++frame.chunk_count;
 
 	if (timestamp_ > 0 && frame.timestamp <= timestamp_) {
 		LOG(ERROR) << "BAD DUPLICATE FRAME - " << timestamp_ - frame.timestamp;
+		return;
 	}
+		
+	++frame.chunk_count;
 
 	if (frame.chunk_count > kChunkCount) LOG(FATAL) << "TOO MANY CHUNKS";
 
-- 
GitLab