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

Test for latency correction

parent c4c1adf8
No related branches found
No related tags found
1 merge request!284Fixes for clock adjustment mistakes
Pipeline #22594 failed
...@@ -281,7 +281,7 @@ bool Net::_sendRequest(Channel c, uint8_t frameset, uint8_t frames, uint8_t coun ...@@ -281,7 +281,7 @@ bool Net::_sendRequest(Channel c, uint8_t frameset, uint8_t frames, uint8_t coun
net_->send(peer_, uri_, (short)0, spkt, pkt); net_->send(peer_, uri_, (short)0, spkt, pkt);
// FIXME: Find a way to use this for correct stream latency info // FIXME: Find a way to use this for correct stream latency info
if (false) { //if (c == Channel::Colour) { // TODO: Not every time if (c == Channel::Colour) { // TODO: Not every time
auto start = std::chrono::high_resolution_clock::now(); auto start = std::chrono::high_resolution_clock::now();
//int64_t mastertime; //int64_t mastertime;
...@@ -292,7 +292,7 @@ bool Net::_sendRequest(Channel c, uint8_t frameset, uint8_t frames, uint8_t coun ...@@ -292,7 +292,7 @@ bool Net::_sendRequest(Channel c, uint8_t frameset, uint8_t frames, uint8_t coun
clock_adjust_ = ftl::timer::get_time() - mastertime + (latency/2); clock_adjust_ = ftl::timer::get_time() - mastertime + (latency/2);
//if (clock_adjust_ > 0) { //if (clock_adjust_ > 0) {
// LOG(INFO) << "Clock adjustment: " << clock_adjust_; //LOG(INFO) << "LATENCY: " << latency;
//} //}
}); });
} catch (...) { } catch (...) {
...@@ -364,7 +364,7 @@ bool Net::_processRequest(ftl::net::Peer &p, const ftl::codecs::Packet &pkt) { ...@@ -364,7 +364,7 @@ bool Net::_processRequest(ftl::net::Peer &p, const ftl::codecs::Packet &pkt) {
int64_t latency = std::chrono::duration_cast<std::chrono::milliseconds>(elapsed).count(); int64_t latency = std::chrono::duration_cast<std::chrono::milliseconds>(elapsed).count();
auto clock_adjust = mastertime - (ftl::timer::get_time() + (latency/2)); auto clock_adjust = mastertime - (ftl::timer::get_time() + (latency/2));
if (clock_adjust > 0) { if (clock_adjust != 0) {
LOG(INFO) << "Clock adjustment: " << clock_adjust; LOG(INFO) << "Clock adjustment: " << clock_adjust;
//LOG(INFO) << "Latency: " << (latency / 2); //LOG(INFO) << "Latency: " << (latency / 2);
//LOG(INFO) << "Local: " << std::chrono::time_point_cast<std::chrono::milliseconds>(start).time_since_epoch().count() << ", master: " << mastertime; //LOG(INFO) << "Local: " << std::chrono::time_point_cast<std::chrono::milliseconds>(start).time_since_epoch().count() << ", master: " << mastertime;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment