From fcaaae14626f24de6915c1c3923bbaef3ffe10b2 Mon Sep 17 00:00:00 2001
From: Nicolas Pope <nwpope@utu.fi>
Date: Thu, 14 May 2020 11:34:00 +0300
Subject: [PATCH] Fixes to file recording

---
 applications/calibration-multi/src/main.cpp | 3 +++
 components/streams/src/filestream.cpp       | 6 ++++--
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/applications/calibration-multi/src/main.cpp b/applications/calibration-multi/src/main.cpp
index 624c85e74..46e2122b2 100644
--- a/applications/calibration-multi/src/main.cpp
+++ b/applications/calibration-multi/src/main.cpp
@@ -444,6 +444,7 @@ void runCameraCalibration(	ftl::Configurable* root,
 
 	int iter = 0;
 	Mat show;
+	cv::Mat show2;
 
 	vector<int> visible;
 	vector<vector<Point2d>> points(n_cameras);
@@ -536,6 +537,8 @@ void runCameraCalibration(	ftl::Configurable* root,
 
 		stack(rgb, show);
 		cv::namedWindow("Cameras", cv::WINDOW_KEEPRATIO | cv::WINDOW_NORMAL);
+		//cv::resize(show, show2, cv::Size(float(show.cols) / float(show.rows) * 1080.0f, 1080));
+		cv::resizeWindow("Cameras", cv::Size(2*1920,1080));
 		cv::imshow("Cameras", show);
 	}
 	cv::destroyWindow("Cameras");
diff --git a/components/streams/src/filestream.cpp b/components/streams/src/filestream.cpp
index b25c0248e..5650862dd 100644
--- a/components/streams/src/filestream.cpp
+++ b/components/streams/src/filestream.cpp
@@ -41,7 +41,7 @@ bool File::_checkFile() {
 	int count = 10;
 	int64_t ts = -1000;
 	int min_ts_diff = 1000;
-	first_ts_ = 10000000;
+	first_ts_ = 10000000000000ll;
 
 	while (count > 0) {
 		std::tuple<ftl::codecs::StreamPacket,ftl::codecs::Packet> data;
@@ -54,6 +54,8 @@ bool File::_checkFile() {
 
 		if (spkt.timestamp < first_ts_) first_ts_ = spkt.timestamp;
 
+		//LOG(INFO) << "TIMESTAMP: " << spkt.timestamp;
+
 		if (spkt.timestamp > 0 && int(spkt.channel) < 32) {
 			if (spkt.timestamp > ts) {
 				--count;
@@ -104,7 +106,7 @@ bool File::post(const ftl::codecs::StreamPacket &s, const ftl::codecs::Packet &p
 
 	ftl::codecs::StreamPacket s2 = s;
 	// Adjust timestamp relative to start of file.
-	s2.timestamp -= timestart_;
+	//s2.timestamp -= timestart_;
 
 	auto data = std::make_tuple(s2,p);
 	msgpack::sbuffer buffer;
-- 
GitLab