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}
This commit is contained in:
Mirta Dvornicic 2019-10-03 15:52:36 +02:00 committed by Commit Bot
parent 6cf554ecb4
commit 608083b66e
2 changed files with 3 additions and 2 deletions

View File

@ -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;

View File

@ -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) {