Skip to content
Snippets Groups Projects
Commit 247fa4a9 authored by Nicolas Pope's avatar Nicolas Pope
Browse files

Set FPS centrally

parent ed7cf66a
No related branches found
No related tags found
1 merge request!95Implements #156 expose config options
Pipeline #12899 failed
...@@ -60,6 +60,8 @@ struct TimerHandle { ...@@ -60,6 +60,8 @@ struct TimerHandle {
*/ */
void setInterval(int ms); void setInterval(int ms);
int getInterval();
/** /**
* Add the specified number of milliseconds to the clock when generating * Add the specified number of milliseconds to the clock when generating
* timestamps. This is used to synchronise clocks on multiple machines as it * timestamps. This is used to synchronise clocks on multiple machines as it
......
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
#include <ftl/configurable.hpp> #include <ftl/configurable.hpp>
#include <ftl/uri.hpp> #include <ftl/uri.hpp>
#include <ftl/threads.hpp> #include <ftl/threads.hpp>
#include <ftl/timer.hpp>
#include <fstream> #include <fstream>
#include <string> #include <string>
...@@ -515,6 +516,9 @@ Configurable *ftl::config::configure(int argc, char **argv, const std::string &r ...@@ -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"]; //LOG(INFO) << "CONFIG: " << config["vision_default"];
//CHECK_EQ( &config, config_index["ftl://utu.fi"] ); //CHECK_EQ( &config, config_index["ftl://utu.fi"] );
......
...@@ -77,6 +77,10 @@ void ftl::timer::setInterval(int ms) { ...@@ -77,6 +77,10 @@ void ftl::timer::setInterval(int ms) {
mspf = ms; mspf = ms;
} }
int ftl::timer::getInterval() {
return mspf;
}
void ftl::timer::setClockAdjustment(int64_t ms) { void ftl::timer::setClockAdjustment(int64_t ms) {
clock_adjust = ms; clock_adjust = ms;
} }
......
...@@ -6,6 +6,12 @@ ...@@ -6,6 +6,12 @@
using ftl::Configurable; using ftl::Configurable;
using std::string; using std::string;
namespace ftl {
namespace timer {
void setInterval(int i) {}
}
}
SCENARIO( "Configurable::get()" ) { SCENARIO( "Configurable::get()" ) {
GIVEN( "a non-existent property" ) { GIVEN( "a non-existent property" ) {
// cppcheck-suppress constStatement // cppcheck-suppress constStatement
......
...@@ -438,7 +438,7 @@ void Peer::data() { ...@@ -438,7 +438,7 @@ void Peer::data() {
auto buf = recv_buf_.buffer(); auto buf = recv_buf_.buffer();
lk.unlock(); lk.unlock();
#ifndef WIN32 /*#ifndef WIN32
int n; int n;
unsigned int m = sizeof(n); unsigned int m = sizeof(n);
getsockopt(sock_,SOL_SOCKET,SO_RCVBUF,(void *)&n, &m); getsockopt(sock_,SOL_SOCKET,SO_RCVBUF,(void *)&n, &m);
...@@ -446,7 +446,7 @@ void Peer::data() { ...@@ -446,7 +446,7 @@ void Peer::data() {
int pending; int pending;
ioctl(sock_, SIOCINQ, &pending); ioctl(sock_, SIOCINQ, &pending);
if (pending > 100000) LOG(INFO) << "Buffer usage: " << float(pending) / float(n); if (pending > 100000) LOG(INFO) << "Buffer usage: " << float(pending) / float(n);
#endif #endif*/
rc = ftl::net::internal::recv(sock_, buf, cap, 0); rc = ftl::net::internal::recv(sock_, buf, cap, 0);
if (rc >= cap-1) { if (rc >= cap-1) {
......
...@@ -15,7 +15,10 @@ Group::Group() : framesets_(kFrameBufferSize), head_(0) { ...@@ -15,7 +15,10 @@ Group::Group() : framesets_(kFrameBufferSize), head_(0) {
framesets_[0].timestamp = -1; framesets_[0].timestamp = -1;
jobs_ = 0; jobs_ = 0;
skip_ = false; skip_ = false;
setFPS(20); //setFPS(20);
mspf_ = ftl::timer::getInterval();
setLatency(5); setLatency(5);
} }
......
...@@ -33,11 +33,11 @@ Streamer::Streamer(nlohmann::json &config, Universe *net) ...@@ -33,11 +33,11 @@ Streamer::Streamer(nlohmann::json &config, Universe *net)
net_ = net; net_ = net;
time_peer_ = ftl::UUID(0); time_peer_ = ftl::UUID(0);
clock_adjust_ = 0; clock_adjust_ = 0;
mspf_ = 1000 / value("fps", 20); mspf_ = ftl::timer::getInterval(); //1000 / value("fps", 20);
//last_dropped_ = 0; //last_dropped_ = 0;
//drop_count_ = 0; //drop_count_ = 0;
group_.setFPS(value("fps", 20)); //group_.setFPS(value("fps", 20));
group_.setLatency(10); group_.setLatency(10);
compress_level_ = value("compression", 1); compress_level_ = value("compression", 1);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment