Index: webrtc/video/send_statistics_proxy_unittest.cc |
diff --git a/webrtc/video/send_statistics_proxy_unittest.cc b/webrtc/video/send_statistics_proxy_unittest.cc |
index 8e6b7bcab3159e0c7e1566a1853bc002d88ba201..c422422604521e2c23cc95ec2d4f1284345a24b9 100644 |
--- a/webrtc/video/send_statistics_proxy_unittest.cc |
+++ b/webrtc/video/send_statistics_proxy_unittest.cc |
@@ -16,6 +16,7 @@ |
#include <vector> |
#include "testing/gtest/include/gtest/gtest.h" |
+#include "webrtc/test/histogram.h" |
namespace webrtc { |
@@ -384,6 +385,50 @@ TEST_F(SendStatisticsProxyTest, ClearsResolutionFromInactiveSsrcs) { |
EXPECT_EQ(0, stats.substreams[config_.rtp.ssrcs[1]].height); |
} |
+TEST_F(SendStatisticsProxyTest, Qp) { |
+ const int kQpIdx0 = 21; |
+ const int kQpIdx1 = 39; |
+ EncodedImage encoded_image; |
+ |
+ RTPVideoHeader rtp_video_header; |
+ rtp_video_header.codec = kRtpVideoVp8; |
+ |
+ rtp_video_header.simulcastIdx = 0; |
+ encoded_image.qp_ = kQpIdx0; |
+ statistics_proxy_->OnSendEncodedImage(encoded_image, &rtp_video_header); |
+ |
+ rtp_video_header.simulcastIdx = 1; |
+ encoded_image.qp_ = kQpIdx1; |
+ statistics_proxy_->OnSendEncodedImage(encoded_image, &rtp_video_header); |
+ |
+ VideoSendStream::Stats stats = statistics_proxy_->GetStats(); |
+ EXPECT_EQ(kQpIdx0, stats.substreams[config_.rtp.ssrcs[0]].qp); |
+ EXPECT_EQ(kQpIdx1, stats.substreams[config_.rtp.ssrcs[1]].qp); |
+} |
+ |
+TEST_F(SendStatisticsProxyTest, VerifyQpHistogramStats_Vp8) { |
+ test::ClearHistograms(); |
+ const int kMinRequiredSamples = 200; |
+ const int kQpIdx0 = 21; |
+ const int kQpIdx1 = 39; |
+ EncodedImage encoded_image; |
+ |
+ RTPVideoHeader rtp_video_header; |
+ rtp_video_header.codec = kRtpVideoVp8; |
+ |
+ for (int i = 0; i < kMinRequiredSamples; ++i) { |
+ rtp_video_header.simulcastIdx = 0; |
+ encoded_image.qp_ = kQpIdx0; |
+ statistics_proxy_->OnSendEncodedImage(encoded_image, &rtp_video_header); |
+ rtp_video_header.simulcastIdx = 1; |
+ encoded_image.qp_ = kQpIdx1; |
+ statistics_proxy_->OnSendEncodedImage(encoded_image, &rtp_video_header); |
+ } |
+ statistics_proxy_.reset(); |
+ EXPECT_EQ(2, test::NumHistogramSamples("WebRTC.Video.Encoded.Vp8.Qp")); |
+ EXPECT_EQ(kQpIdx1, test::LastHistogramSample("WebRTC.Video.Encoded.Vp8.Qp")); |
+} |
+ |
TEST_F(SendStatisticsProxyTest, ClearsBitratesFromInactiveSsrcs) { |
BitrateStatistics bitrate; |
bitrate.bitrate_bps = 42; |