Reset QP sum when QP is not reported on decoded frame.
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 <asapersson@webrtc.org>
Commit-Queue: Mirta Dvornicic <mirtad@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#29373}
diff --git a/video/receive_statistics_proxy.cc b/video/receive_statistics_proxy.cc
index 4f3b6b9..42ab7e1 100644
--- a/video/receive_statistics_proxy.cc
+++ b/video/receive_statistics_proxy.cc
@@ -692,6 +692,7 @@
} 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 e572789..fffc42c 100644
--- a/video/receive_statistics_proxy_unittest.cc
+++ b/video/receive_statistics_proxy_unittest.cc
@@ -352,7 +352,7 @@
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 @@
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) {