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 {
*/
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
......
......
......@@ -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"] );
......
......
......@@ -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;
}
......
......
......@@ -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
......
......
......@@ -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) {
......
......
......@@ -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);
}
......
......
......@@ -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);
......
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment