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

Fix for bad pool timestamping

parent fa3983b4
No related branches found
No related tags found
1 merge request!333Resolves #373 Frameset timestamp errors
Pipeline #29071 passed
......@@ -346,7 +346,7 @@ void Receiver::_finishPacket(ftl::streams::LockedFrameSet &fs, size_t fix) {
if (frame.packet_tx > 0 && frame.packet_tx == frame.packet_rx) {
fs->completed(fix);
if (fs->isComplete()) {
LOG(INFO) << "COMPLETE: " << fs->timestamp() << ", " << fix;
//LOG(INFO) << "COMPLETE: " << fs->timestamp() << ", " << fix;
timestamp_ = fs->timestamp();
}
frame.packet_tx = 0;
......@@ -362,7 +362,7 @@ void Receiver::processPackets(const StreamPacket &spkt, const Packet &pkt) {
if (fs) {
fs->frames[spkt.frame_number].packet_tx = static_cast<int>(pkt.packet_count);
LOG(INFO) << "EXPECTED " << fs->frames[spkt.frame_number].packet_tx;
//LOG(INFO) << "EXPECTED " << fs->frames[spkt.frame_number].packet_tx << " for " << int(spkt.frame_number);
_finishPacket(fs, spkt.frame_number);
}
return;
......
......@@ -154,6 +154,8 @@ void Sender::_send(ftl::rgbd::FrameSet &fs, ftl::codecs::StreamPacket &spkt, con
spkt.flags = ftl::codecs::kFlagCompleted;
}*/
if (spkt.frame_number == 255) LOG(WARNING) << "Bad frame number";
if (spkt.frame_number == 255) ++fs.frames[0].packet_tx;
else if (spkt.frame_number < fs.frames.size() && fs.frames[spkt.frame_number].source() == spkt.frame_number) ++fs.frames[spkt.frame_number].packet_tx;
else {
......
......@@ -151,7 +151,7 @@ TEST_CASE( "Multi-thread stability testing" ) {
auto h1 = pool.onFlushSet([sender](ftl::data::FrameSet &fs, ftl::codecs::Channel c) {
if (!fs.test(ftl::data::FSFlag::AUTO_SEND)) return true;
LOG(INFO) << "FLUSH: " << fs.timestamp() << ", " << int(c);
//LOG(INFO) << "FLUSH: " << fs.timestamp() << ", " << int(c);
sender->post(fs, c);
return true;
});
......@@ -200,7 +200,7 @@ TEST_CASE( "Multi-thread stability testing" ) {
auto h1 = pool.onFlushSet([sender](ftl::data::FrameSet &fs, ftl::codecs::Channel c) {
if (!fs.test(ftl::data::FSFlag::AUTO_SEND)) return true;
LOG(INFO) << "FLUSH: " << fs.timestamp() << ", " << int(c) << ", " << fs.frames[0].source();
//LOG(INFO) << "FLUSH: " << fs.timestamp() << ", " << int(c) << ", " << fs.frames[0].source();
sender->post(fs, c);
return true;
});
......@@ -221,7 +221,9 @@ TEST_CASE( "Multi-thread stability testing" ) {
return true;
});
auto h2 = ftl::timer::add(ftl::timer::timerlevel_t::kTimerMain, [&pool](int64_t ts) {
ftl::data::Pool pool2(5,7);
auto h2 = ftl::timer::add(ftl::timer::timerlevel_t::kTimerMain, [&pool,&pool2](int64_t ts) {
ftl::pool.push([&pool, ts](int id) {
Frame f = pool.allocate(ftl::data::FrameID(0,0), ts);
f.store();
......
......@@ -25,8 +25,8 @@ Frame Pool::allocate(FrameID id, int64_t timestamp) {
UNIQUE_LOCK(mutex_, lk);
auto &pool = _getPool(id);
if (timestamp < pool.last_timestamp) {
timestamp = pool.last_timestamp;
if (timestamp <= pool.last_timestamp) {
//timestamp = pool.last_timestamp;
//throw FTL_Error("New frame timestamp is older than previous: " << timestamp << " vs " << pool.last_timestamp);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment