From c1b7e0041f5b8f02a34058eb38dc8b2da4f776e1 Mon Sep 17 00:00:00 2001 From: Nicolas Pope <nwpope@utu.fi> Date: Wed, 9 Oct 2019 12:55:25 +0300 Subject: [PATCH] Don't decode unwanted frames --- components/rgbd-sources/src/net.cpp | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/components/rgbd-sources/src/net.cpp b/components/rgbd-sources/src/net.cpp index f720651d6..416defb9a 100644 --- a/components/rgbd-sources/src/net.cpp +++ b/components/rgbd-sources/src/net.cpp @@ -248,26 +248,24 @@ void NetSource::_recvPacket(short ttimeoff, const ftl::codecs::StreamPacket &spk const ftl::rgbd::Channel chan = host_->getChannel(); int rchan = spkt.channel & 0x1; - // Ignore any unwanted second channel - if (chan == ftl::rgbd::Channel::None && rchan > 0) { - LOG(INFO) << "Unwanted channel"; - //return; - // TODO: Allow decode to be skipped - } - NetFrame &frame = queue_.getFrame(spkt.timestamp, cv::Size(params_.width, params_.height), CV_8UC3, (isFloatChannel(chan) ? CV_32FC1 : CV_8UC3)); // Update frame statistics frame.tx_size += pkt.data.size(); - _createDecoder(rchan, pkt); - auto *decoder = (rchan == 0) ? decoder_c1_ : decoder_c2_; - if (!decoder) { - LOG(ERROR) << "No frame decoder available"; - return; - } + // Ignore any unwanted second channel + if (!(chan == ftl::rgbd::Channel::None && rchan > 0)) { + _createDecoder(rchan, pkt); + auto *decoder = (rchan == 0) ? decoder_c1_ : decoder_c2_; + if (!decoder) { + LOG(ERROR) << "No frame decoder available"; + return; + } - decoder->decode(pkt, (rchan == 0) ? frame.channel1 : frame.channel2); + decoder->decode(pkt, (rchan == 0) ? frame.channel1 : frame.channel2); + } else { + //LOG(INFO) << "Unwanted frame"; + } // Apply colour correction to chunk //ftl::rgbd::colourCorrection(tmp_rgb, gamma_, temperature_); -- GitLab