Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(297)

Unified Diff: webrtc/video/send_statistics_proxy_unittest.cc

Issue 1264693003: Add QP stats for sent video streams to StatsReport. Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: add unit tests Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/video/send_statistics_proxy.cc ('k') | webrtc/video_send_stream.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « webrtc/video/send_statistics_proxy.cc ('k') | webrtc/video_send_stream.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698