From dd806d16476ade74d3970d92ab8c4bccda8b4ea5 Mon Sep 17 00:00:00 2001
From: Nicolas Pope <nicolas.pope@utu.fi>
Date: Thu, 23 Jan 2020 13:39:05 +0200
Subject: [PATCH] Implements #287 independent rendering

---
 applications/gui/src/camera.cpp     |  4 ++--
 applications/gui/src/src_window.cpp | 10 ++++++++++
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/applications/gui/src/camera.cpp b/applications/gui/src/camera.cpp
index df514b2ff..9aba01850 100644
--- a/applications/gui/src/camera.cpp
+++ b/applications/gui/src/camera.cpp
@@ -276,9 +276,9 @@ void ftl::gui::Camera::update(ftl::rgbd::FrameSet &fs) {
 		name_ = "Virtual Camera";
 		// Do a draw if not active. If active the draw function will be called
 		// directly.
-		//if (screen_->activeCamera() != this) {
+		if (screen_->activeCamera() != this) {
 			_draw(fs);
-		//}
+		}
 	} else {
 		if (fid_ >= fs.frames.size()) return;
 		frame = &fs.frames[fid_];
diff --git a/applications/gui/src/src_window.cpp b/applications/gui/src/src_window.cpp
index cc1f2aa0a..01eaf3a17 100644
--- a/applications/gui/src/src_window.cpp
+++ b/applications/gui/src/src_window.cpp
@@ -125,6 +125,16 @@ SourceWindow::SourceWindow(ftl::gui::Screen *screen)
 		return true;
 	});
 
+	ftl::timer::add(ftl::timer::kTimerMain, [this](int64_t ts) {
+		auto *c = screen_->activeCamera();
+		// Only offer full framerate render on active camera.
+		if (c) {
+			UNIQUE_LOCK(frameset_.mtx,lk);
+			c->draw(frameset_);
+		}
+		return true;
+	});
+
 	_updateCameras(screen_->control()->getNet()->findAll<string>("list_streams"));
 
 	// Also check for a file on command line.
-- 
GitLab