diff --git a/components/rgbd-sources/include/ftl/rgbd/streamer.hpp b/components/rgbd-sources/include/ftl/rgbd/streamer.hpp index e832fb546bdead7334367ccf14b2b024ba36e7b7..665f9af9d54350dfc7bbd8acef5173d36986e255 100644 --- a/components/rgbd-sources/include/ftl/rgbd/streamer.hpp +++ b/components/rgbd-sources/include/ftl/rgbd/streamer.hpp @@ -112,6 +112,7 @@ class Streamer : public ftl::Configurable { std::mutex job_mtx_; std::condition_variable job_cv_; std::atomic<int> jobs_; + int compress_level_; void _schedule(); void _swap(detail::StreamSource *); diff --git a/components/rgbd-sources/src/streamer.cpp b/components/rgbd-sources/src/streamer.cpp index ace68b6eee29e3cdc371eaeeece59bf27b8f477c..9e693533815f95aa08bbe368e66bef71e245aa78 100644 --- a/components/rgbd-sources/src/streamer.cpp +++ b/components/rgbd-sources/src/streamer.cpp @@ -27,6 +27,8 @@ Streamer::Streamer(nlohmann::json &config, Universe *net) active_ = false; net_ = net; + + compress_level_ = value("compression", 1); net->bind("find_stream", [this](const std::string &uri) -> optional<UUID> { SHARED_LOCK(mutex_,slk); @@ -307,7 +309,7 @@ void Streamer::_schedule() { //if (delta) d3 = (d2 * 2) - chunkDepthPrev; //else d3 = d2; //d2.copyTo(chunkDepthPrev); - vector<int> pngparams = {cv::IMWRITE_PNG_COMPRESSION, 1}; // Default is 1 for fast, 9 = small but slow. + vector<int> pngparams = {cv::IMWRITE_PNG_COMPRESSION, compress_level_}; // Default is 1 for fast, 9 = small but slow. cv::imencode(".png", d2, d_buf, pngparams); //LOG(INFO) << "Sending chunk " << chunk << " : size = " << (d_buf.size()+rgb_buf.size()) / 1024 << "kb";