From 9cbe8223293f558b375042145f3896a4cbad862f Mon Sep 17 00:00:00 2001
From: Nicolas Pope <nwpope@utu.fi>
Date: Fri, 28 Aug 2020 15:07:16 +0300
Subject: [PATCH] Code tidy

---
 components/common/cpp/include/ftl/threads.hpp       | 2 +-
 components/streams/include/ftl/streams/receiver.hpp | 3 ---
 components/streams/src/filestream.cpp               | 4 ++--
 components/streams/src/receiver.cpp                 | 8 --------
 4 files changed, 3 insertions(+), 14 deletions(-)

diff --git a/components/common/cpp/include/ftl/threads.hpp b/components/common/cpp/include/ftl/threads.hpp
index 1e60a2007..c40ed095b 100644
--- a/components/common/cpp/include/ftl/threads.hpp
+++ b/components/common/cpp/include/ftl/threads.hpp
@@ -7,7 +7,7 @@
 
 #define POOL_SIZE 10
 
-#define DEBUG_MUTEX
+//#define DEBUG_MUTEX
 #define MUTEX_TIMEOUT 2
 
 #if defined DEBUG_MUTEX
diff --git a/components/streams/include/ftl/streams/receiver.hpp b/components/streams/include/ftl/streams/receiver.hpp
index 9895ee878..090014243 100644
--- a/components/streams/include/ftl/streams/receiver.hpp
+++ b/components/streams/include/ftl/streams/receiver.hpp
@@ -64,9 +64,6 @@ class Receiver : public ftl::Configurable, public ftl::data::Generator {
 		InternalVideoStates();
 
 		int64_t timestamps[32];
-		int64_t interval = 2000;
-		std::pair<ftl::codecs::StreamPacket, ftl::codecs::Packet> todos[32];
-		//ftl::rgbd::Frame frame;
 		ftl::codecs::Decoder* decoders[32];
 		cv::cuda::GpuMat surface[32];
 		RECURSIVE_MUTEX mutex;
diff --git a/components/streams/src/filestream.cpp b/components/streams/src/filestream.cpp
index 69216ece2..a49b743e7 100644
--- a/components/streams/src/filestream.cpp
+++ b/components/streams/src/filestream.cpp
@@ -532,7 +532,7 @@ bool File::end() {
 }
 
 void File::reset() {
-	UNIQUE_LOCK(mutex_, lk);
+	/*UNIQUE_LOCK(mutex_, lk);
 
 	// TODO: Find a better solution
 	while (jobs_ > 0) std::this_thread::sleep_for(std::chrono::milliseconds(2));
@@ -544,7 +544,7 @@ void File::reset() {
 
 	timestart_ = (ftl::timer::get_time() / ftl::timer::getInterval()) * ftl::timer::getInterval();
 	//timestamp_ = timestart_;
-	for (auto &fsd : framesets_) fsd.second.timestamp = timestart_;
+	for (auto &fsd : framesets_) fsd.second.timestamp = timestart_;*/
 }
 
 bool File::active() {
diff --git a/components/streams/src/receiver.cpp b/components/streams/src/receiver.cpp
index 70b192cca..97c58c7dc 100644
--- a/components/streams/src/receiver.cpp
+++ b/components/streams/src/receiver.cpp
@@ -119,7 +119,6 @@ Receiver::InternalVideoStates::InternalVideoStates() {
 	for (int i=0; i<32; ++i) {
 		decoders[i] = nullptr;
 		timestamps[i] = 0;
-		todos[i].first.timestamp = -1;
 	}
 }
 
@@ -406,13 +405,6 @@ void Receiver::_processVideo(const StreamPacket &spkt, const Packet &pkt) {
 
 		_finishPacket(fs, spkt.frame_number);
 	}
-
-	{
-		UNIQUE_LOCK(ividstate.mutex, lk);
-		if (ividstate.todos[int(spkt.channel)].first.timestamp > spkt.timestamp) {
-			_processVideo(ividstate.todos[int(spkt.channel)].first, ividstate.todos[int(spkt.channel)].second);
-		}
-	}
 }
 
 void Receiver::_finishPacket(ftl::streams::LockedFrameSet &fs, size_t fix) {
-- 
GitLab