From efe827d186cf60786edb0c6914ca6f5870a7c4c5 Mon Sep 17 00:00:00 2001 From: Sebastian Hahta <joseha@utu.fi> Date: Thu, 26 Sep 2019 13:02:56 +0300 Subject: [PATCH] fix right channel streaming --- components/rgbd-sources/src/streamer.cpp | 2 +- components/rgbd-sources/src/virtual.cpp | 18 ++++++++++++------ 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/components/rgbd-sources/src/streamer.cpp b/components/rgbd-sources/src/streamer.cpp index 7a9118c9f..676cf58cf 100644 --- a/components/rgbd-sources/src/streamer.cpp +++ b/components/rgbd-sources/src/streamer.cpp @@ -496,7 +496,7 @@ void Streamer::_transmitPacket(StreamSource *src, const ftl::codecs::Packet &pkt frame_no_, static_cast<uint8_t>((chan & 0x1) | ((hasChan2) ? 0x2 : 0x0)) }; - + LOG(INFO) << "codec:" << (int) pkt.codec; // Lock to prevent clients being added / removed //SHARED_LOCK(src->mutex,lk); auto c = src->clients.begin(); diff --git a/components/rgbd-sources/src/virtual.cpp b/components/rgbd-sources/src/virtual.cpp index 62b404155..0e6db9738 100644 --- a/components/rgbd-sources/src/virtual.cpp +++ b/components/rgbd-sources/src/virtual.cpp @@ -36,13 +36,19 @@ class VirtualImpl : public ftl::rgbd::detail::Source { LOG(ERROR) << "Unknown exception in render callback"; } - if (frame.hasChannel(Channel::Colour) && frame.hasChannel(Channel::Depth)) { - frame.download(Channel::Colour + Channel::Depth); - cv::swap(frame.get<cv::Mat>(Channel::Colour), rgb_); - cv::swap(frame.get<cv::Mat>(Channel::Depth), depth_); - LOG(INFO) << "Written: " << rgb_.cols; + if (frame.hasChannel(Channel::Colour)) { + frame.download(Channel::Colour); + cv::swap(frame.get<cv::Mat>(Channel::Colour), rgb_); } else { - LOG(ERROR) << "Missing colour or depth frame in rendering"; + LOG(ERROR) << "Channel 1 frame in rendering"; + } + + if ((host_->getChannel() != Channel::None) && + frame.hasChannel(host_->getChannel())) { + frame.download(host_->getChannel()); + cv::swap(frame.get<cv::Mat>(host_->getChannel()), depth_); + } else { + LOG(ERROR) << "Channel 2 frame in rendering"; } auto cb = host_->callback(); -- GitLab