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

Unified Diff: webrtc/video/send_statistics_proxy_unittest.cc

Issue 1543933004: Fix for stats updated twice when switching content type. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: rebase Created 4 years, 11 months 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') | no next file » | 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 f098ce2d239e309bc23ee64dc55429f572cdbcab..fc1f3fdbdea1ad3a287198aaf259af4c9e655273 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 {
@@ -296,6 +297,25 @@ TEST_F(SendStatisticsProxyTest, OnEncodedFrame) {
EXPECT_EQ(kEncodeTimeMs, stats.avg_encode_time_ms);
}
+TEST_F(SendStatisticsProxyTest, SwitchContentTypeUpdatesHistograms) {
+ test::ClearHistograms();
+ const int kMinRequiredSamples = 200;
+ const int kWidth = 640;
+ const int kHeight = 480;
+
+ for (int i = 0; i < kMinRequiredSamples; ++i)
+ statistics_proxy_->OnIncomingFrame(kWidth, kHeight);
+
+ // No switch, stats not should be updated.
+ statistics_proxy_->SetContentType(
+ VideoEncoderConfig::ContentType::kRealtimeVideo);
+ EXPECT_EQ(0, test::NumHistogramSamples("WebRTC.Video.InputWidthInPixels"));
+
+ // Switch to screenshare, real-time stats should be updated.
+ statistics_proxy_->SetContentType(VideoEncoderConfig::ContentType::kScreen);
+ EXPECT_EQ(1, test::NumHistogramSamples("WebRTC.Video.InputWidthInPixels"));
+}
+
TEST_F(SendStatisticsProxyTest, NoSubstreams) {
uint32_t excluded_ssrc =
std::max(
« no previous file with comments | « webrtc/video/send_statistics_proxy.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698