From e4e04fc081e8134b9a50c46f569bd146ba8989a5 Mon Sep 17 00:00:00 2001 From: Nicolas Pope <nwpope@utu.fi> Date: Sun, 15 Dec 2019 19:58:39 +0200 Subject: [PATCH] Fix for broken net frame sync --- components/rgbd-sources/src/sources/net/net.cpp | 3 ++- components/rgbd-sources/src/streamer.cpp | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/components/rgbd-sources/src/sources/net/net.cpp b/components/rgbd-sources/src/sources/net/net.cpp index 3a9d4730c..cb8603cc4 100644 --- a/components/rgbd-sources/src/sources/net/net.cpp +++ b/components/rgbd-sources/src/sources/net/net.cpp @@ -301,7 +301,6 @@ void NetSource::_recvPacket(short ttimeoff, const ftl::codecs::StreamPacket &spk } ++frame.chunk_count[channum]; - if (frame.chunk_count[channum] == frame.chunk_total[channum]) ++frame.channel_count; if (frame.chunk_count[channum] > frame.chunk_total[channum]) { LOG(WARNING) << "Too many channel packets received, discarding"; return; @@ -336,6 +335,8 @@ void NetSource::_recvPacket(short ttimeoff, const ftl::codecs::StreamPacket &spk // TODO:(Nick) Decode directly into double buffer if no scaling + if (frame.chunk_count[channum] == frame.chunk_total[channum]) ++frame.channel_count; + // Last chunk of both channels now received, so we are done. if (frame.channel_count == spkt.channel_count) { _completeFrame(frame, now-(spkt.timestamp+frame.tx_latency)); diff --git a/components/rgbd-sources/src/streamer.cpp b/components/rgbd-sources/src/streamer.cpp index 4c70127d3..3ca2bade8 100644 --- a/components/rgbd-sources/src/streamer.cpp +++ b/components/rgbd-sources/src/streamer.cpp @@ -494,7 +494,7 @@ void Streamer::_process(ftl::rgbd::FrameSet &fs) { // TODO: Stagger the reset between nodes... random phasing if (fs.timestamp % (10*ftl::timer::getInterval()) == 0) enc1->reset(); - enc1->encode(fs.frames[j].get<cv::cuda::GpuMat>(Channel::Colour), src->hq_bitrate, [this,src,hasChan2,&mtx](const ftl::codecs::Packet &blk){ + enc1->encode(fs.frames[j].get<cv::cuda::GpuMat>(Channel::Colour), src->hq_bitrate, [this,src,hasChan2](const ftl::codecs::Packet &blk){ _transmitPacket(src, blk, Channel::Colour, hasChan2, Quality::High); }); -- GitLab