From 46e7098f634e47a977cd1b76eaa50f38970a0bcd Mon Sep 17 00:00:00 2001
From: Nicolas Pope <nicolas.pope@utu.fi>
Date: Thu, 26 Sep 2019 13:44:59 +0300
Subject: [PATCH] Use single block for small thumbnails

---
 components/codecs/src/opencv_encoder.cpp | 5 ++---
 web-service/src/index.js                 | 6 +++++-
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/components/codecs/src/opencv_encoder.cpp b/components/codecs/src/opencv_encoder.cpp
index 5dafabf29..028395b9e 100644
--- a/components/codecs/src/opencv_encoder.cpp
+++ b/components/codecs/src/opencv_encoder.cpp
@@ -37,9 +37,8 @@ bool OpenCVEncoder::encode(const cv::Mat &in, definition_t definition, bitrate_t
 		tmp.convertTo(tmp, CV_16UC1, 1000);
 	}
 
-	// TODO: Choose these base upon resolution
-	chunk_count_ = 16;
-	chunk_dim_ = 4;
+	chunk_dim_ = (definition == definition_t::LD360) ? 1 : 4;
+	chunk_count_ = chunk_dim_ * chunk_dim_;
 	jobs_ = chunk_count_;
 
 	for (int i=0; i<chunk_count_; ++i) {
diff --git a/web-service/src/index.js b/web-service/src/index.js
index a0f7f894b..7dc39a2a1 100644
--- a/web-service/src/index.js
+++ b/web-service/src/index.js
@@ -94,13 +94,17 @@ RGBDStream.prototype.subscribe = function() {
 	this.rxcount = 0;
 	this.rxmax = 10;
 	//console.log("Subscribe to ", this.uri);
-	this.peer.send("get_stream", this.uri, 10, 0, [Peer.uuid], this.uri);
+	// TODO: Don't hard code 9 here, instead use 9 for thumbnails and 0 for
+	// the video...
+	this.peer.send("get_stream", this.uri, 10, 9, [Peer.uuid], this.uri);
 }
 
 RGBDStream.prototype.pushFrames = function(latency, spacket, packet) {
 	if (spacket[1] & 0x1) this.depth = packet[4];
 	else this.rgb = packet[4];
 
+	console.log("Frame = ", packet[0], packet[1]);
+
 	for (let i=0; i < this.clients.length; i++) {
 		this.clients[i].push(this.uri, latency, spacket, packet);
 	}
-- 
GitLab