From 608083b66e54f2f1e5a1b87e38166a5645f6603b Mon Sep 17 00:00:00 2001 From: Mirta Dvornicic Date: Thu, 3 Oct 2019 15:52:36 +0200 Subject: [PATCH] Reset QP sum when QP is not reported on decoded frame. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit To avoid incorrect QP sum in the reported stats and to avoid log spam when switching from a decoder that reports QP to a decoder that does not report QP. Bug: None Change-Id: Ib5ef4d6227344b0d03c3d75596b4a07ef427ae1c Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/155444 Reviewed-by: Åsa Persson Commit-Queue: Mirta Dvornicic Cr-Commit-Position: refs/heads/master@{#29373} --- video/receive_statistics_proxy.cc | 1 + video/receive_statistics_proxy_unittest.cc | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/video/receive_statistics_proxy.cc b/video/receive_statistics_proxy.cc index 4f3b6b9db8..42ab7e19ec 100644 --- a/video/receive_statistics_proxy.cc +++ b/video/receive_statistics_proxy.cc @@ -692,6 +692,7 @@ void ReceiveStatisticsProxy::OnDecodedFrame(const VideoFrame& frame, } else if (stats_.qp_sum) { RTC_LOG(LS_WARNING) << "QP sum was already set and no QP was given for a frame."; + stats_.qp_sum.reset(); } decode_time_counter_.Add(decode_time_ms); stats_.decode_ms = decode_time_ms; diff --git a/video/receive_statistics_proxy_unittest.cc b/video/receive_statistics_proxy_unittest.cc index e5727894f6..fffc42ce0d 100644 --- a/video/receive_statistics_proxy_unittest.cc +++ b/video/receive_statistics_proxy_unittest.cc @@ -352,7 +352,7 @@ TEST_F(ReceiveStatisticsProxyTest, OnDecodedFrameWithoutQpQpSumWontExist) { EXPECT_EQ(absl::nullopt, statistics_proxy_->GetStats().qp_sum); } -TEST_F(ReceiveStatisticsProxyTest, OnDecodedFrameWithoutQpDoesNotResetQpSum) { +TEST_F(ReceiveStatisticsProxyTest, OnDecodedFrameWithoutQpResetsQpSum) { webrtc::VideoFrame frame = CreateFrame(kWidth, kHeight); EXPECT_EQ(absl::nullopt, statistics_proxy_->GetStats().qp_sum); statistics_proxy_->OnDecodedFrame(frame, 3u, 0, @@ -360,7 +360,7 @@ TEST_F(ReceiveStatisticsProxyTest, OnDecodedFrameWithoutQpDoesNotResetQpSum) { EXPECT_EQ(3u, statistics_proxy_->GetStats().qp_sum); statistics_proxy_->OnDecodedFrame(frame, absl::nullopt, 0, VideoContentType::UNSPECIFIED); - EXPECT_EQ(3u, statistics_proxy_->GetStats().qp_sum); + EXPECT_EQ(absl::nullopt, statistics_proxy_->GetStats().qp_sum); } TEST_F(ReceiveStatisticsProxyTest, OnRenderedFrameIncreasesFramesRendered) {