From 2b1b2b17eaa692f8df2a973ce520ece9196d6956 Mon Sep 17 00:00:00 2001 From: Nicolas Pope <nwpope@utu.fi> Date: Sat, 6 Jun 2020 10:23:47 +0300 Subject: [PATCH] Remove all video decode dependence on definition --- components/streams/src/receiver.cpp | 11 ++++++++--- components/streams/test/receiver_unit.cpp | 2 +- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/components/streams/src/receiver.cpp b/components/streams/src/receiver.cpp index da2a97577..30043cd5f 100644 --- a/components/streams/src/receiver.cpp +++ b/components/streams/src/receiver.cpp @@ -222,9 +222,14 @@ void Receiver::_processVideo(const StreamPacket &spkt, const Packet &pkt) { InternalVideoStates &ividstate = _getVideoFrame(spkt); auto [tx,ty] = ftl::codecs::chooseTileConfig(pkt.frame_count); - int width = ftl::codecs::getWidth(pkt.definition); - int height = ftl::codecs::getHeight(pkt.definition); - int sheight = height; + + int width = ividstate.state.getLeft().width; + int height = ividstate.state.getLeft().height; + + if (width == 0 || height == 0) { + LOG(WARNING) << "No calibration, skipping frame"; + return; + } //LOG(INFO) << " CODEC = " << (int)pkt.codec << " " << (int)pkt.flags << " " << (int)spkt.channel; //LOG(INFO) << "Decode surface: " << (width*tx) << "x" << (height*ty); diff --git a/components/streams/test/receiver_unit.cpp b/components/streams/test/receiver_unit.cpp index 1a00ad4ee..7ff3df42d 100644 --- a/components/streams/test/receiver_unit.cpp +++ b/components/streams/test/receiver_unit.cpp @@ -119,7 +119,7 @@ TEST_CASE( "Receiver generating onFrameSet" ) { SECTION("multi-frameset") { cv::cuda::GpuMat m(cv::Size(1280,720), CV_8UC4, cv::Scalar(0)); - ftl::stream::injectCalibration(&stream, dummy, 1, 0, 0); + ftl::stream::injectCalibration(&stream, dummy, 1, 1, 0); bool r = encoder.encode(m, pkt); REQUIRE( r ); -- GitLab