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

Fix for bad frameset init

parent 5e4de288
No related branches found
No related tags found
1 merge request!95Implements #156 expose config options
Pipeline #12927 passed
This commit is part of merge request !95. Comments created here will be created in the context of that merge request.
...@@ -191,7 +191,7 @@ void Group::sync(std::function<bool(ftl::rgbd::FrameSet &)> cb) { ...@@ -191,7 +191,7 @@ void Group::sync(std::function<bool(ftl::rgbd::FrameSet &)> cb) {
// The buffers are invalid after callback so mark stale // The buffers are invalid after callback so mark stale
fs->stale = true; fs->stale = true;
} else { } else {
DLOG(INFO) << "NO FRAME FOUND: " << last_ts_ - latency_*mspf_; //LOG(INFO) << "NO FRAME FOUND: " << last_ts_ - latency_*mspf_;
} }
} }
...@@ -232,11 +232,12 @@ ftl::rgbd::FrameSet *Group::_getFrameset(int f) { ...@@ -232,11 +232,12 @@ ftl::rgbd::FrameSet *Group::_getFrameset(int f) {
} }
void Group::_addFrameset(int64_t timestamp) { void Group::_addFrameset(int64_t timestamp) {
int count = (framesets_[head_].timestamp == -1) ? 1 : (timestamp - framesets_[head_].timestamp) / mspf_; int count = (framesets_[head_].timestamp == -1) ? 200 : (timestamp - framesets_[head_].timestamp) / mspf_;
//LOG(INFO) << "Massive timestamp difference: " << count;
// Allow for massive timestamp changes (Windows clock adjust) // Allow for massive timestamp changes (Windows clock adjust)
// Only add a single frameset for large changes // Only add a single frameset for large changes
if (count < -kFrameBufferSize || count >= kFrameBufferSize-1) { if (count < -int(kFrameBufferSize) || count >= kFrameBufferSize-1) {
head_ = (head_+1) % kFrameBufferSize; head_ = (head_+1) % kFrameBufferSize;
if (!framesets_[head_].mtx.try_lock()) { if (!framesets_[head_].mtx.try_lock()) {
......
...@@ -185,7 +185,7 @@ void NetSource::_recvChunk(int64_t ts, int chunk, bool delta, const vector<unsig ...@@ -185,7 +185,7 @@ void NetSource::_recvChunk(int64_t ts, int chunk, bool delta, const vector<unsig
auto start = std::chrono::high_resolution_clock::now(); auto start = std::chrono::high_resolution_clock::now();
int64_t now = std::chrono::time_point_cast<std::chrono::milliseconds>(start).time_since_epoch().count(); int64_t now = std::chrono::time_point_cast<std::chrono::milliseconds>(start).time_since_epoch().count();
//if (now-ts < 10) LOG(INFO) << ts << " - Chunk Latency = " << (now - ts) << " - " << ftl::pool.q_size(); //LOG(INFO) << ts << " - Chunk Latency (" << chunk_count_ << ") = " << (now - ts) << " - " << ftl::pool.q_size();
//if (now - ts > 160) { //if (now - ts > 160) {
// LOG(INFO) << "OLD PACKET: " << host_->getURI() << " (" << chunk << ") - " << ts << " (" << (now - ts) << ")"; // LOG(INFO) << "OLD PACKET: " << host_->getURI() << " (" << chunk << ") - " << ts << " (" << (now - ts) << ")";
//} //}
...@@ -238,7 +238,7 @@ void NetSource::_recvChunk(int64_t ts, int chunk, bool delta, const vector<unsig ...@@ -238,7 +238,7 @@ void NetSource::_recvChunk(int64_t ts, int chunk, bool delta, const vector<unsig
timestamp_ = frame.timestamp; timestamp_ = frame.timestamp;
if (frame.timestamp >= 0 && frame.chunk_count == chunk_count_) { if (frame.timestamp >= 0 && frame.chunk_count == chunk_count_) {
//LOG(INFO) << "Frame finished"; //LOG(INFO) << "Frame finished: " << frame.timestamp;
auto cb = host_->callback(); auto cb = host_->callback();
if (cb) { if (cb) {
cb(frame.timestamp, frame.channel1, frame.channel2); cb(frame.timestamp, frame.channel1, frame.channel2);
......
...@@ -377,7 +377,7 @@ void Streamer::_encodeAndTransmit(StreamSource *src, const cv::Mat &rgb, const c ...@@ -377,7 +377,7 @@ void Streamer::_encodeAndTransmit(StreamSource *src, const cv::Mat &rgb, const c
(*c).txcount = (*c).txmax; (*c).txcount = (*c).txmax;
} else { } else {
++(*c).txcount; ++(*c).txcount;
//LOG(INFO) << "SENT CHUNK : " << frame_no_*mspf_ << "-" << chunk; //LOG(INFO) << "SENT CHUNK : " << frame_no_ << "-" << chunk;
} }
} catch(...) { } catch(...) {
(*c).txcount = (*c).txmax; (*c).txcount = (*c).txmax;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment