diff --git a/components/common/cpp/include/ftl/timer.hpp b/components/common/cpp/include/ftl/timer.hpp index 045f29375d26acc4f3d1406a65ca31febce1f319..6af48cd1cd4b053e69586af88e90be3c4ded0c35 100644 --- a/components/common/cpp/include/ftl/timer.hpp +++ b/components/common/cpp/include/ftl/timer.hpp @@ -60,6 +60,8 @@ struct TimerHandle { */ void setInterval(int ms); +int getInterval(); + /** * Add the specified number of milliseconds to the clock when generating * timestamps. This is used to synchronise clocks on multiple machines as it diff --git a/components/common/cpp/src/configuration.cpp b/components/common/cpp/src/configuration.cpp index 3343832ac133e5128e135ba1199b26154e0eb641..06cf11c854c99845ef57e8b72d6ad11bbfac0cd3 100644 --- a/components/common/cpp/src/configuration.cpp +++ b/components/common/cpp/src/configuration.cpp @@ -19,6 +19,7 @@ #include <ftl/configurable.hpp> #include <ftl/uri.hpp> #include <ftl/threads.hpp> +#include <ftl/timer.hpp> #include <fstream> #include <string> @@ -515,6 +516,9 @@ Configurable *ftl::config::configure(int argc, char **argv, const std::string &r } }); + // Some global settings + ftl::timer::setInterval(rootcfg->value("fps",20)); + //LOG(INFO) << "CONFIG: " << config["vision_default"]; //CHECK_EQ( &config, config_index["ftl://utu.fi"] ); diff --git a/components/common/cpp/src/timer.cpp b/components/common/cpp/src/timer.cpp index eb6ea802472d848f3cd8ef029a4f8aff092d377c..5f96f9045aac2cf506f28e9440f787b5d3f6a8d9 100644 --- a/components/common/cpp/src/timer.cpp +++ b/components/common/cpp/src/timer.cpp @@ -77,6 +77,10 @@ void ftl::timer::setInterval(int ms) { mspf = ms; } +int ftl::timer::getInterval() { + return mspf; +} + void ftl::timer::setClockAdjustment(int64_t ms) { clock_adjust = ms; } diff --git a/components/common/cpp/test/configurable_unit.cpp b/components/common/cpp/test/configurable_unit.cpp index 428208f7465a85421eb1c7864f384a9dcc3f7a98..af44e026a552279da53986dde38079e7695a889b 100644 --- a/components/common/cpp/test/configurable_unit.cpp +++ b/components/common/cpp/test/configurable_unit.cpp @@ -6,6 +6,12 @@ using ftl::Configurable; using std::string; +namespace ftl { +namespace timer { +void setInterval(int i) {} +} +} + SCENARIO( "Configurable::get()" ) { GIVEN( "a non-existent property" ) { // cppcheck-suppress constStatement diff --git a/components/net/cpp/src/peer.cpp b/components/net/cpp/src/peer.cpp index 6a864ac93fb9dd590f325c85d19b184977bce362..6738470fe013e533d769a1cb3c860537a0cfa4ff 100644 --- a/components/net/cpp/src/peer.cpp +++ b/components/net/cpp/src/peer.cpp @@ -438,7 +438,7 @@ void Peer::data() { auto buf = recv_buf_.buffer(); lk.unlock(); - #ifndef WIN32 + /*#ifndef WIN32 int n; unsigned int m = sizeof(n); getsockopt(sock_,SOL_SOCKET,SO_RCVBUF,(void *)&n, &m); @@ -446,7 +446,7 @@ void Peer::data() { int pending; ioctl(sock_, SIOCINQ, &pending); if (pending > 100000) LOG(INFO) << "Buffer usage: " << float(pending) / float(n); - #endif + #endif*/ rc = ftl::net::internal::recv(sock_, buf, cap, 0); if (rc >= cap-1) { diff --git a/components/rgbd-sources/src/group.cpp b/components/rgbd-sources/src/group.cpp index 3b3d9afffede25362bf3d44681e06ac2e219fb45..29c4ef38d221e113d25c2564d3b39310ca032189 100644 --- a/components/rgbd-sources/src/group.cpp +++ b/components/rgbd-sources/src/group.cpp @@ -15,7 +15,10 @@ Group::Group() : framesets_(kFrameBufferSize), head_(0) { framesets_[0].timestamp = -1; jobs_ = 0; skip_ = false; - setFPS(20); + //setFPS(20); + + mspf_ = ftl::timer::getInterval(); + setLatency(5); } diff --git a/components/rgbd-sources/src/streamer.cpp b/components/rgbd-sources/src/streamer.cpp index 35339ecf0696b94248eb8aecc6394a7817330182..e854ac590e03c9fc291edca479981a90f939a6be 100644 --- a/components/rgbd-sources/src/streamer.cpp +++ b/components/rgbd-sources/src/streamer.cpp @@ -33,11 +33,11 @@ Streamer::Streamer(nlohmann::json &config, Universe *net) net_ = net; time_peer_ = ftl::UUID(0); clock_adjust_ = 0; - mspf_ = 1000 / value("fps", 20); + mspf_ = ftl::timer::getInterval(); //1000 / value("fps", 20); //last_dropped_ = 0; //drop_count_ = 0; - group_.setFPS(value("fps", 20)); + //group_.setFPS(value("fps", 20)); group_.setLatency(10); compress_level_ = value("compression", 1);