From b288ae664c71b31873b6869bc930cd86c1b91414 Mon Sep 17 00:00:00 2001
From: Nicolas Pope <nwpope@utu.fi>
Date: Mon, 9 Mar 2020 10:43:21 +0200
Subject: [PATCH] Finish warning as error corrections

---
 applications/ftl2mkv/src/main.cpp                    |  2 +-
 applications/gui/src/camera.cpp                      | 12 ++----------
 applications/gui/src/config_window.cpp               | 10 +---------
 applications/gui/src/main.cpp                        |  3 ---
 applications/gui/src/media_panel.cpp                 |  1 +
 applications/gui/src/src_window.cpp                  | 10 +++++-----
 applications/gui/src/src_window.hpp                  |  2 +-
 applications/reconstruct/src/reconstruction.cpp      | 10 ----------
 applications/vision/src/main.cpp                     |  1 -
 components/codecs/include/ftl/codecs/packet.hpp      |  2 +-
 components/operators/src/detectandtrack.cpp          |  2 +-
 components/operators/src/fusion/mvmls.cpp            |  2 +-
 components/operators/src/poser.cpp                   |  4 ++--
 components/operators/src/segmentation.cu             |  8 ++++----
 components/rgbd-sources/src/cb_segmentation.cpp      |  2 +-
 components/rgbd-sources/src/frameset.cpp             |  4 ++--
 .../src/sources/realsense/realsense_source.cpp       |  4 ++--
 .../src/sources/screencapture/screencapture.cpp      |  3 ---
 .../src/sources/screencapture/screencapture.hpp      | 12 ++++++------
 components/streams/include/ftl/streams/receiver.hpp  |  2 +-
 components/streams/include/ftl/streams/stream.hpp    |  8 ++++----
 components/streams/src/filestream.cpp                |  3 +--
 components/streams/src/netstream.cpp                 |  4 ++--
 components/streams/src/receiver.cpp                  | 10 +++++-----
 components/streams/src/sender.cpp                    |  2 +-
 components/streams/src/stream.cpp                    |  8 ++++----
 26 files changed, 49 insertions(+), 82 deletions(-)

diff --git a/applications/ftl2mkv/src/main.cpp b/applications/ftl2mkv/src/main.cpp
index 783bacb20..6c52bd2a1 100644
--- a/applications/ftl2mkv/src/main.cpp
+++ b/applications/ftl2mkv/src/main.cpp
@@ -27,7 +27,7 @@ static AVStream *add_video_stream(AVFormatContext *oc, const ftl::codecs::Packet
         exit(1);
     }
 
-	AVCodecID codec_id;
+	AVCodecID codec_id = AV_CODEC_ID_HEVC;
 	switch (pkt.codec) {
 	case codec_t::HEVC_LOSSLESS:
 	case codec_t::HEVC : codec_id = AV_CODEC_ID_HEVC; break;
diff --git a/applications/gui/src/camera.cpp b/applications/gui/src/camera.cpp
index 46a42a38b..887094437 100644
--- a/applications/gui/src/camera.cpp
+++ b/applications/gui/src/camera.cpp
@@ -137,14 +137,6 @@ ftl::gui::Camera::~Camera() {
 	//delete fileout_;
 }
 
-static Eigen::Vector3f cudaToEigen(const float3 &v) {
-	Eigen::Vector3f e;
-	e[0] = v.x;
-	e[1] = v.y;
-	e[2] = v.z;
-	return e;
-}
-
 void ftl::gui::Camera::drawUpdated(std::vector<ftl::rgbd::FrameSet*> &fss) {
 	// Only draw if frameset updated.
 	if (!stale_frame_.test_and_set()) {
@@ -677,8 +669,8 @@ const void ftl::gui::Camera::captureFrame() {
 				Eigen::Matrix4d eye_l = ConvertSteamVRMatrixToMatrix4(
 					vr::VRSystem()->GetEyeToHeadTransform(vr::Eye_Left));
 				
-				Eigen::Matrix4d eye_r = ConvertSteamVRMatrixToMatrix4(
-					vr::VRSystem()->GetEyeToHeadTransform(vr::Eye_Left));
+				//Eigen::Matrix4d eye_r = ConvertSteamVRMatrixToMatrix4(
+				//	vr::VRSystem()->GetEyeToHeadTransform(vr::Eye_Left));
 
 				float baseline_in = 2.0 * eye_l(0, 3);
 				
diff --git a/applications/gui/src/config_window.cpp b/applications/gui/src/config_window.cpp
index 69b103851..6dd1b4d8a 100644
--- a/applications/gui/src/config_window.cpp
+++ b/applications/gui/src/config_window.cpp
@@ -71,14 +71,6 @@ static std::string titleForURI(const ftl::URI &uri) {
 	}
 }
 
-static std::string genPadding(const std::string &str, size_t count) {
-	std::string res = "";
-	for (size_t i=0; i<count; ++i) {
-		res += str;
-	}
-	return res;
-}
-
 ConfigWindow::ConfigWindow(nanogui::Widget *parent, ftl::ctrl::Master *ctrl)
 		: nanogui::Window(parent, "Settings"), ctrl_(ctrl) {
 	using namespace nanogui;
@@ -102,7 +94,7 @@ ConfigWindow::ConfigWindow(nanogui::Widget *parent, ftl::ctrl::Master *ctrl)
 	searchBox->setButtons(buttons);
 
 	std::vector<std::string> configurable_titles(size);
-	for (int i = 0; i < size; ++i) {
+	for (size_t i = 0; i < size; ++i) {
 		ftl::URI uri(configurables[i]);
 		std::string label = uri.getFragment();
 
diff --git a/applications/gui/src/main.cpp b/applications/gui/src/main.cpp
index 4bc4e197b..03146915e 100644
--- a/applications/gui/src/main.cpp
+++ b/applications/gui/src/main.cpp
@@ -49,10 +49,8 @@ int main(int argc, char **argv) {
 			//nanogui::mainloop(20);
 
 			float last_draw_time = 0.0f;
-			float last_vr_time = 0.0f;
 
 			while (ftl::running) {
-				nanogui::Screen *screen = app;
 				if (!app->visible()) {
 					ftl::running = false;
 				} else if (glfwWindowShouldClose(app->glfwWindow())) {
@@ -65,7 +63,6 @@ int main(int argc, char **argv) {
 					// Generate poses and render and virtual frame here
 					// at full FPS (25 without VR and 90 with VR currently)
 					app->drawFast();
-					last_vr_time = now;
 
 					// Only draw the GUI at 25fps
 					if (delta >= 0.04f) {
diff --git a/applications/gui/src/media_panel.cpp b/applications/gui/src/media_panel.cpp
index 7197ef47a..63d9d911a 100644
--- a/applications/gui/src/media_panel.cpp
+++ b/applications/gui/src/media_panel.cpp
@@ -207,6 +207,7 @@ void MediaPanel::_startRecording(MediaPanel::RecordMode mode) {
 	case RecordMode::Snapshot3D		:
 	case RecordMode::Video3D		: filename += ".ftl"; break;
 	case RecordMode::Video2D		: filename += ".ftl"; break;
+	default: return;
 	}
 
 	if (mode == RecordMode::Video3D) {
diff --git a/applications/gui/src/src_window.cpp b/applications/gui/src/src_window.cpp
index 405c4ee44..b9b9b957f 100644
--- a/applications/gui/src/src_window.cpp
+++ b/applications/gui/src/src_window.cpp
@@ -210,7 +210,7 @@ bool SourceWindow::_processFrameset(ftl::rgbd::FrameSet &fs, bool fromstream) {
 	if (!paused_) {
 		if (!fs.test(ftl::data::FSFlag::PARTIAL) || !screen_->root()->value("drop_partial_framesets", false)) { 
 			// Enforce interpolated colour and GPU upload
-			for (int i=0; i<fs.frames.size(); ++i) {
+			for (size_t i=0; i<fs.frames.size(); ++i) {
 				if (!fs.hasFrame(i)) continue;
 				fs.frames[i].createTexture<uchar4>(Channel::Colour, true);
 
@@ -239,7 +239,7 @@ bool SourceWindow::_processFrameset(ftl::rgbd::FrameSet &fs, bool fromstream) {
 
 	//LOG(INFO) << "Channels = " << (unsigned int)cstream->available(fs.id);
 
-	int i=0;
+	size_t i=0;
 	for (auto cam : cameras_) {
 		// Only update the camera periodically unless the active camera
 		if (screen_->activeCamera() == cam.second.camera ||
@@ -255,7 +255,7 @@ bool SourceWindow::_processFrameset(ftl::rgbd::FrameSet &fs, bool fromstream) {
 	return true;
 }
 
-void SourceWindow::_checkFrameSets(int id) {
+void SourceWindow::_checkFrameSets(size_t id) {
 	while (framesets_.size() <= id) {
 		auto *p = ftl::config::create<ftl::operators::Graph>(screen_->root(), std::string("pre_filters") + std::to_string(framesets_.size()));
 		p->append<ftl::operators::DepthChannel>("depth")->value("enabled", false);
@@ -315,8 +315,8 @@ ftl::codecs::Channels<0> SourceWindow::_aggregateChannels(int id) {
 }
 
 void SourceWindow::_createDefaultCameras(ftl::rgbd::FrameSet &fs, bool makevirtual) {
-	for (int i=0; i<fs.frames.size(); ++i) {
-		int id = (fs.id << 8) + i;
+	for (size_t i=0; i<fs.frames.size(); ++i) {
+		size_t id = (fs.id << 8) + i;
 		if (cameras_.find(id) == cameras_.end()) {
 			auto *cam = new ftl::gui::Camera(screen_, 1 << fs.id, i);
 			cameras_[id] = {
diff --git a/applications/gui/src/src_window.hpp b/applications/gui/src/src_window.hpp
index c420c0e7c..83e9779b7 100644
--- a/applications/gui/src/src_window.hpp
+++ b/applications/gui/src/src_window.hpp
@@ -83,7 +83,7 @@ class SourceWindow : public nanogui::Window {
 	void _updateCameras(const std::vector<std::string> &netcams);
 	void _createDefaultCameras(ftl::rgbd::FrameSet &fs, bool makevirtual);
 	ftl::codecs::Channels<0> _aggregateChannels(int id);
-	void _checkFrameSets(int id);
+	void _checkFrameSets(size_t id);
 	bool _processFrameset(ftl::rgbd::FrameSet &fs, bool);
 
 };
diff --git a/applications/reconstruct/src/reconstruction.cpp b/applications/reconstruct/src/reconstruction.cpp
index 9ae89fc0d..e8267fc85 100644
--- a/applications/reconstruct/src/reconstruction.cpp
+++ b/applications/reconstruct/src/reconstruction.cpp
@@ -14,16 +14,6 @@
 using ftl::Reconstruction;
 using ftl::codecs::Channel;
 
-static Eigen::Affine3d create_rotation_matrix(float ax, float ay, float az) {
-	Eigen::Affine3d rx =
-		Eigen::Affine3d(Eigen::AngleAxisd(ax, Eigen::Vector3d(1, 0, 0)));
-	Eigen::Affine3d ry =
-		Eigen::Affine3d(Eigen::AngleAxisd(ay, Eigen::Vector3d(0, 1, 0)));
-	Eigen::Affine3d rz =
-		Eigen::Affine3d(Eigen::AngleAxisd(az, Eigen::Vector3d(0, 0, 1)));
-	return rz * rx * ry;
-}
-
 Reconstruction::Reconstruction(nlohmann::json &config, const std::string name) :
 	ftl::Configurable(config), busy_(false), rbusy_(false), new_frame_(false), fs_render_(), fs_align_() {
 	gen_ = nullptr;
diff --git a/applications/vision/src/main.cpp b/applications/vision/src/main.cpp
index 2dfabcc42..615e8f05a 100644
--- a/applications/vision/src/main.cpp
+++ b/applications/vision/src/main.cpp
@@ -86,7 +86,6 @@ static void run(ftl::Configurable *root) {
 		if (sync_counter-- <= 0 && time_peer != ftl::UUID(0) ) {
 			sync_counter = 20;
 			auto start = std::chrono::high_resolution_clock::now();
-			int64_t now = ftl::timer::get_time();
 
 			try {
 				net->asyncCall<int64_t>(time_peer, "__ping__", [start](const int64_t &mastertime) {
diff --git a/components/codecs/include/ftl/codecs/packet.hpp b/components/codecs/include/ftl/codecs/packet.hpp
index cace36128..b07561785 100644
--- a/components/codecs/include/ftl/codecs/packet.hpp
+++ b/components/codecs/include/ftl/codecs/packet.hpp
@@ -73,7 +73,7 @@ struct StreamPacket {
 	ftl::codecs::Channel channel;		// Actual channel of this current set of packets
 
 	inline int frameNumber() const { return (version >= 4) ? frame_number : streamID; }
-	inline int frameSetID() const { return (version >= 4) ? streamID : 0; }
+	inline size_t frameSetID() const { return (version >= 4) ? streamID : 0; }
 	inline int64_t localTimestamp() const { return timestamp + originClockDelta; }
 
 	int64_t originClockDelta;  // Not message packet / saved
diff --git a/components/operators/src/detectandtrack.cpp b/components/operators/src/detectandtrack.cpp
index 195ae5ada..7135d2e0b 100644
--- a/components/operators/src/detectandtrack.cpp
+++ b/components/operators/src/detectandtrack.cpp
@@ -171,7 +171,7 @@ bool DetectAndTrack::detect(const Mat &im) {
 
 		//LOG(INFO) << "Face confidence: " << levelWeights[best_ix];
 
-		if (!found && (tracked_.size() < max_tracked_)) {
+		if (!found && (tracked_.size() < static_cast<size_t>(max_tracked_))) {
 			createTracker(im, obj);
 		}
 	}
diff --git a/components/operators/src/fusion/mvmls.cpp b/components/operators/src/fusion/mvmls.cpp
index 200a9d9a5..0dfe26b14 100644
--- a/components/operators/src/fusion/mvmls.cpp
+++ b/components/operators/src/fusion/mvmls.cpp
@@ -33,7 +33,7 @@ bool MultiViewMLS::apply(ftl::rgbd::FrameSet &in, ftl::rgbd::FrameSet &out, cuda
     int win = config()->value("window_size",16);
     bool do_corr = config()->value("merge_corresponding", true);
 	bool do_aggr = config()->value("merge_mls", false);
-    bool do_colour_adjust = config()->value("apply_colour_adjust", false);
+    //bool do_colour_adjust = config()->value("apply_colour_adjust", false);
 	bool cull_zero = config()->value("cull_no_confidence", false);
     //bool show_best_source = config()->value("show_pixel_source", false);
 
diff --git a/components/operators/src/poser.cpp b/components/operators/src/poser.cpp
index e2ac71b0c..0ed962f95 100644
--- a/components/operators/src/poser.cpp
+++ b/components/operators/src/poser.cpp
@@ -24,9 +24,9 @@ bool Poser::apply(ftl::rgbd::FrameSet &in, ftl::rgbd::FrameSet &out, cudaStream_
         std::vector<ftl::codecs::Shape3D> transforms;
         in.get(Channel::Shapes3D, transforms);
 
-        for (auto &t : transforms) {
+        //for (auto &t : transforms) {
             //LOG(INFO) << "Have FS transform: " << t.id;
-        }
+        //}
     }
 
 	for (size_t i=0; i<in.frames.size(); ++i) {
diff --git a/components/operators/src/segmentation.cu b/components/operators/src/segmentation.cu
index f38008e7b..cf115136d 100644
--- a/components/operators/src/segmentation.cu
+++ b/components/operators/src/segmentation.cu
@@ -27,9 +27,9 @@ __device__ inline float cross<float>(float p1, float p2) {
 template <typename T, bool SYM>
 __device__ uchar4 calculate_support_region(const TextureObject<T> &img, int x, int y, float tau, int v_max, int h_max) {
     int x_min = max(0, x - h_max);
-    int x_max = min(img.width()-1, x + h_max);
+    int x_max = min(img.width()-1, static_cast<unsigned long>(x + h_max));
     int y_min = max(0, y - v_max);
-    int y_max = min(img.height()-1, y + v_max);
+    int y_max = min(img.height()-1, static_cast<unsigned long>(y + v_max));
 
 	uchar4 result = make_uchar4(0, 0, 0, 0);
 
@@ -93,9 +93,9 @@ __device__ uchar4 calculate_support_region(const TextureObject<T> &img, int x, i
 
 __device__ uchar4 calculate_support_region(const TextureObject<uint8_t> &img, int x, int y, int v_max, int h_max) {
     int x_min = max(0, x - h_max);
-    int x_max = min(img.width()-1, x + h_max);
+    int x_max = min(img.width()-1, static_cast<unsigned long>(x + h_max));
     int y_min = max(0, y - v_max);
-    int y_max = min(img.height()-1, y + v_max);
+    int y_max = min(img.height()-1, static_cast<unsigned long>(y + v_max));
 
 	uchar4 result = make_uchar4(0, 0, 0, 0);
 
diff --git a/components/rgbd-sources/src/cb_segmentation.cpp b/components/rgbd-sources/src/cb_segmentation.cpp
index 88ca91e77..5fd0f7571 100644
--- a/components/rgbd-sources/src/cb_segmentation.cpp
+++ b/components/rgbd-sources/src/cb_segmentation.cpp
@@ -83,7 +83,7 @@ CBSegmentation::CBSegmentation(
 		char codebook_size, size_t width, size_t height,
 		float alpha, float beta, float epsilon, float sigma,
 		int T_add, int T_del, int T_h) :
-		width_(width), height_(height), size_(codebook_size + 1),
+		size_(codebook_size + 1), width_(width), height_(height),
 		alpha_(alpha), beta_(beta), epsilon_(epsilon), sigma_(sigma),
 		T_add_(T_add), T_del_(T_del), T_h_(T_h) {
 	
diff --git a/components/rgbd-sources/src/frameset.cpp b/components/rgbd-sources/src/frameset.cpp
index 0ed610f79..9f721fb70 100644
--- a/components/rgbd-sources/src/frameset.cpp
+++ b/components/rgbd-sources/src/frameset.cpp
@@ -206,7 +206,7 @@ void Builder::_schedule() {
 			UNIQUE_LOCK(fs->mtx, lk2);
 
 			// Calling onFrameset but without all frames so mark as partial
-			if (fs->count < fs->frames.size()) fs->set(ftl::data::FSFlag::PARTIAL);
+			if (static_cast<size_t>(fs->count) < fs->frames.size()) fs->set(ftl::data::FSFlag::PARTIAL);
 
 			try {
 				if (cb_) cb_(*fs);
@@ -311,7 +311,7 @@ ftl::rgbd::FrameSet *Builder::_getFrameset() {
 		while (N-- > 0 && i != framesets_.end()) ++i;
 	// Otherwise skip to first fully completed frame
 	} else {
-		while (i != framesets_.end() && (*i)->count < (*i)->frames.size()) ++i;
+		while (i != framesets_.end() && static_cast<size_t>((*i)->count) < (*i)->frames.size()) ++i;
 	}
 
 	if (i != framesets_.end()) {
diff --git a/components/rgbd-sources/src/sources/realsense/realsense_source.cpp b/components/rgbd-sources/src/sources/realsense/realsense_source.cpp
index 3198b53e8..ea061ba2c 100644
--- a/components/rgbd-sources/src/sources/realsense/realsense_source.cpp
+++ b/components/rgbd-sources/src/sources/realsense/realsense_source.cpp
@@ -56,8 +56,8 @@ bool RealsenseSource::compute(int n, int b) {
 
     if (host_->value("colour_only", false)) {
         auto cframe = frames.get_color_frame();
-        int w = cframe.get_width();
-        int h = cframe.get_height();
+        size_t w = cframe.get_width();
+        size_t h = cframe.get_height();
 
         if (params_.width != w) {
             params_.width = w;
diff --git a/components/rgbd-sources/src/sources/screencapture/screencapture.cpp b/components/rgbd-sources/src/sources/screencapture/screencapture.cpp
index 2b56065fe..a3565f3df 100644
--- a/components/rgbd-sources/src/sources/screencapture/screencapture.cpp
+++ b/components/rgbd-sources/src/sources/screencapture/screencapture.cpp
@@ -58,9 +58,6 @@ ScreenCapture::ScreenCapture(ftl::rgbd::Source *host)
         : ftl::rgbd::detail::Source(host) {
 	capabilities_ = kCapVideo;
 
-	const uint WIDTH  = 1280;
-	const uint HEIGHT = 720;
-
 	ready_ = false;
 
     #ifdef HAVE_X11
diff --git a/components/rgbd-sources/src/sources/screencapture/screencapture.hpp b/components/rgbd-sources/src/sources/screencapture/screencapture.hpp
index a6f19f4f5..8480359e6 100644
--- a/components/rgbd-sources/src/sources/screencapture/screencapture.hpp
+++ b/components/rgbd-sources/src/sources/screencapture/screencapture.hpp
@@ -28,8 +28,8 @@ class ScreenCapture : public ftl::rgbd::detail::Source {
 	bool compute(int n=-1, int b=-1);
 	bool isReady();
 
-	int getOffsetX() const { return (offset_x_ > full_width_-params_.width) ? full_width_-params_.width : offset_x_; }
-	int getOffsetY() const { return (offset_y_ > full_height_-params_.height) ? full_height_-params_.height : offset_y_; }
+	size_t getOffsetX() const { return (offset_x_ > full_width_-params_.width) ? full_width_-params_.width : offset_x_; }
+	size_t getOffsetY() const { return (offset_y_ > full_height_-params_.height) ? full_height_-params_.height : offset_y_; }
 
 	private:
 	bool ready_;
@@ -37,10 +37,10 @@ class ScreenCapture : public ftl::rgbd::detail::Source {
 	int64_t cur_ts_;
 	ftl::rgbd::Frame sframe_;
 
-	int full_width_;
-	int full_height_;
-	int offset_x_;
-	int offset_y_;
+	size_t full_width_;
+	size_t full_height_;
+	size_t offset_x_;
+	size_t offset_y_;
 
 	ImplState *impl_state_;
 };
diff --git a/components/streams/include/ftl/streams/receiver.hpp b/components/streams/include/ftl/streams/receiver.hpp
index f33963118..840af0388 100644
--- a/components/streams/include/ftl/streams/receiver.hpp
+++ b/components/streams/include/ftl/streams/receiver.hpp
@@ -41,7 +41,7 @@ class Receiver : public ftl::Configurable, public ftl::rgbd::Generator {
 	/**
 	 * Add a frameset handler to a specific stream ID.
 	 */
-	void onFrameSet(int s, const ftl::rgbd::VideoCallback &cb);
+	void onFrameSet(size_t s, const ftl::rgbd::VideoCallback &cb);
 
 	void onAudio(const ftl::audio::FrameSet::Callback &cb);
 
diff --git a/components/streams/include/ftl/streams/stream.hpp b/components/streams/include/ftl/streams/stream.hpp
index 7929f1ee2..75aa9ab80 100644
--- a/components/streams/include/ftl/streams/stream.hpp
+++ b/components/streams/include/ftl/streams/stream.hpp
@@ -114,7 +114,7 @@ class Muxer : public Stream {
 	explicit Muxer(nlohmann::json &config);
 	virtual ~Muxer();
 
-	void add(Stream *, int fsid=0);
+	void add(Stream *, size_t fsid=0);
 
 	bool onPacket(const StreamCallback &) override;
 
@@ -126,7 +126,7 @@ class Muxer : public Stream {
 
 	void reset() override;
 
-	int originStream(int fsid, int fid);
+	int originStream(size_t fsid, int fid);
 
 	private:
 	struct StreamEntry {
@@ -135,13 +135,13 @@ class Muxer : public Stream {
 	};
 
 	std::vector<StreamEntry> streams_;
-	std::vector<std::pair<int,int>> revmap_[kMaxStreams];
+	std::vector<std::pair<size_t,int>> revmap_[kMaxStreams];
 	int nid_[kMaxStreams];
 	StreamCallback cb_;
 	SHARED_MUTEX mutex_;
 
 	void _notify(const ftl::codecs::StreamPacket &spkt, const ftl::codecs::Packet &pkt);
-	int _lookup(int fsid, int sid, int ssid);
+	int _lookup(size_t fsid, int sid, int ssid);
 };
 
 /**
diff --git a/components/streams/src/filestream.cpp b/components/streams/src/filestream.cpp
index fe7ec994d..189a970f4 100644
--- a/components/streams/src/filestream.cpp
+++ b/components/streams/src/filestream.cpp
@@ -50,7 +50,7 @@ bool File::_checkFile() {
 		}
 
 		auto &spkt = std::get<0>(data);
-		auto &pkt = std::get<1>(data);
+		//auto &pkt = std::get<1>(data);
 
 		if (spkt.timestamp < first_ts_) first_ts_ = spkt.timestamp;
 
@@ -205,7 +205,6 @@ bool File::tick(int64_t ts) {
 		}
 	}
 
-	bool partial = false;
 	int64_t extended_ts = timestamp_ + 200;  // Buffer 200ms ahead
 
 	while ((active_ && istream_->good()) || buffer_in_.nonparsed_size() > 0u) {
diff --git a/components/streams/src/netstream.cpp b/components/streams/src/netstream.cpp
index 21c1542a7..a7cef8a2d 100644
--- a/components/streams/src/netstream.cpp
+++ b/components/streams/src/netstream.cpp
@@ -358,8 +358,8 @@ bool Net::_processRequest(ftl::net::Peer &p, const ftl::codecs::Packet &pkt) {
 }
 
 void Net::_checkDataRate(size_t tx_size, int64_t tx_latency, int64_t ts) {
-	float actual_mbps = (float(tx_size) * 8.0f * (1000.0f / float(tx_latency))) / 1048576.0f;
-    float min_mbps = (float(tx_size) * 8.0f * (1000.0f / float(ftl::timer::getInterval()))) / 1048576.0f;
+	//float actual_mbps = (float(tx_size) * 8.0f * (1000.0f / float(tx_latency))) / 1048576.0f;
+    //float min_mbps = (float(tx_size) * 8.0f * (1000.0f / float(ftl::timer::getInterval()))) / 1048576.0f;
     //if (actual_mbps > 0.0f && actual_mbps < min_mbps) LOG(WARNING) << "Bitrate = " << actual_mbps << "Mbps, min required = " << min_mbps << "Mbps";
 
 	UNIQUE_LOCK(msg_mtx__,lk);
diff --git a/components/streams/src/receiver.cpp b/components/streams/src/receiver.cpp
index a43b95ceb..d34c256bf 100644
--- a/components/streams/src/receiver.cpp
+++ b/components/streams/src/receiver.cpp
@@ -28,14 +28,14 @@ Receiver::Receiver(nlohmann::json &config) : ftl::Configurable(config), stream_(
 	second_channel_ = Channel::Depth;
 
 	size_t bsize = value("frameset_buffer_size", 3);
-	for (int i=0; i<ftl::stream::kMaxStreams; ++i) {
+	for (size_t i=0; i<ftl::stream::kMaxStreams; ++i) {
 		builder_[i].setID(i);
 		builder_[i].setBufferSize(bsize);
 	}
 
 	on("frameset_buffer_size", [this](const ftl::config::Event &e) {
 		size_t bsize = value("frameset_buffer_size", 3);
-		for (int i=0; i<ftl::stream::kMaxStreams; ++i) {
+		for (size_t i=0; i<ftl::stream::kMaxStreams; ++i) {
 			builder_[i].setBufferSize(bsize);
 		}
 	});
@@ -176,7 +176,7 @@ void Receiver::_processAudio(const StreamPacket &spkt, const Packet &pkt) {
 		ftl::audio::FrameSet fs;
 		fs.id = 0;
 		fs.timestamp = frame.timestamp;
-		fs.originClockDelta;
+		//fs.originClockDelta;
 		fs.count = 1;
 		//fs.stale = false;
 		fs.clear(ftl::data::FSFlag::STALE);
@@ -397,11 +397,11 @@ ftl::rgbd::FrameState &Receiver::state(size_t ix) {
 }
 
 void Receiver::onFrameSet(const ftl::rgbd::VideoCallback &cb) {
-	for (int i=0; i<ftl::stream::kMaxStreams; ++i)
+	for (size_t i=0; i<ftl::stream::kMaxStreams; ++i)
 		builder_[i].onFrameSet(cb);
 }
 
-void Receiver::onFrameSet(int s, const ftl::rgbd::VideoCallback &cb) {
+void Receiver::onFrameSet(size_t s, const ftl::rgbd::VideoCallback &cb) {
 	if (s >= 0 && s < ftl::stream::kMaxStreams)
 		builder_[s].onFrameSet(cb);
 }
diff --git a/components/streams/src/sender.cpp b/components/streams/src/sender.cpp
index e0b34d433..b85625fa0 100644
--- a/components/streams/src/sender.cpp
+++ b/components/streams/src/sender.cpp
@@ -327,7 +327,7 @@ void Sender::_encodeChannel(ftl::rgbd::FrameSet &fs, Channel c, bool reset) {
 				else pkt.flags = ftl::codecs::kFlagFlipRGB;
 
 				// In the event of partial frames, add a flag to indicate that
-				if (fs.count < fs.frames.size()) pkt.flags |= ftl::codecs::kFlagPartial;
+				if (static_cast<size_t>(fs.count) < fs.frames.size()) pkt.flags |= ftl::codecs::kFlagPartial;
 
 				// Choose correct region of interest into the surface.
 				cv::Rect roi = _generateROI(fs, cc, offset);
diff --git a/components/streams/src/stream.cpp b/components/streams/src/stream.cpp
index 445300cdb..22d8768d4 100644
--- a/components/streams/src/stream.cpp
+++ b/components/streams/src/stream.cpp
@@ -49,9 +49,9 @@ Muxer::~Muxer() {
 }
 
 
-void Muxer::add(Stream *s, int fsid) {
+void Muxer::add(Stream *s, size_t fsid) {
 	UNIQUE_LOCK(mutex_,lk);
-	if (fsid < 0 || fsid >= ftl::stream::kMaxStreams) return;
+	if (fsid < 0u || fsid >= ftl::stream::kMaxStreams) return;
 
 	auto &se = streams_.emplace_back();
 	int i = streams_.size()-1;
@@ -80,7 +80,7 @@ bool Muxer::onPacket(const std::function<void(const ftl::codecs::StreamPacket &,
 	return true;
 }
 
-int Muxer::originStream(int fsid, int fid) {
+int Muxer::originStream(size_t fsid, int fid) {
 	if (fsid < ftl::stream::kMaxStreams && static_cast<uint32_t>(fid) < revmap_[fsid].size()) {
 		return std::get<0>(revmap_[fsid][fid]);
 	}
@@ -137,7 +137,7 @@ void Muxer::reset() {
 	}
 }
 
-int Muxer::_lookup(int fsid, int sid, int ssid) {
+int Muxer::_lookup(size_t fsid, int sid, int ssid) {
 	SHARED_LOCK(mutex_, lk);
 	auto &se = streams_[sid];
 	if (static_cast<uint32_t>(ssid) >= se.maps.size()) {
-- 
GitLab