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

Side by Side Diff: webrtc/video/send_statistics_proxy_unittest.cc

Issue 2775173004: Add number of quality adapt changes to VideoSendStream stats. (Closed)
Patch Set: rebase Created 3 years, 8 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 unified diff | Download patch
« no previous file with comments | « webrtc/video/send_statistics_proxy.cc ('k') | webrtc/video/vie_encoder_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 TEST_F(SendStatisticsProxyTest, SetQualityScalingUpdatesStats) { 378 TEST_F(SendStatisticsProxyTest, SetQualityScalingUpdatesStats) {
379 EXPECT_FALSE(statistics_proxy_->GetStats().bw_limited_resolution); 379 EXPECT_FALSE(statistics_proxy_->GetStats().bw_limited_resolution);
380 statistics_proxy_->SetQualityScalingStats(-1); 380 statistics_proxy_->SetQualityScalingStats(-1);
381 EXPECT_FALSE(statistics_proxy_->GetStats().bw_limited_resolution); 381 EXPECT_FALSE(statistics_proxy_->GetStats().bw_limited_resolution);
382 statistics_proxy_->SetQualityScalingStats(0); 382 statistics_proxy_->SetQualityScalingStats(0);
383 EXPECT_FALSE(statistics_proxy_->GetStats().bw_limited_resolution); 383 EXPECT_FALSE(statistics_proxy_->GetStats().bw_limited_resolution);
384 statistics_proxy_->SetQualityScalingStats(1); 384 statistics_proxy_->SetQualityScalingStats(1);
385 EXPECT_TRUE(statistics_proxy_->GetStats().bw_limited_resolution); 385 EXPECT_TRUE(statistics_proxy_->GetStats().bw_limited_resolution);
386 } 386 }
387 387
388 TEST_F(SendStatisticsProxyTest, GetStatsReportsCpuResolutionChanges) {
389 EXPECT_FALSE(statistics_proxy_->GetStats().cpu_limited_resolution);
390 EXPECT_EQ(0, statistics_proxy_->GetStats().number_of_cpu_adapt_changes);
391
392 statistics_proxy_->OnCpuRestrictedResolutionChanged(true);
393 EXPECT_TRUE(statistics_proxy_->GetStats().cpu_limited_resolution);
394 EXPECT_EQ(1, statistics_proxy_->GetStats().number_of_cpu_adapt_changes);
395
396 statistics_proxy_->OnCpuRestrictedResolutionChanged(false);
397 EXPECT_FALSE(statistics_proxy_->GetStats().cpu_limited_resolution);
398 EXPECT_EQ(2, statistics_proxy_->GetStats().number_of_cpu_adapt_changes);
399 }
400
401 TEST_F(SendStatisticsProxyTest, GetStatsReportsQualityResolutionChanges) {
402 EXPECT_FALSE(statistics_proxy_->GetStats().bw_limited_resolution);
403 EXPECT_EQ(0, statistics_proxy_->GetStats().number_of_quality_adapt_changes);
404
405 statistics_proxy_->OnQualityRestrictedResolutionChanged(1);
406 EXPECT_TRUE(statistics_proxy_->GetStats().bw_limited_resolution);
407 EXPECT_EQ(1, statistics_proxy_->GetStats().number_of_quality_adapt_changes);
408
409 statistics_proxy_->OnQualityRestrictedResolutionChanged(2);
410 EXPECT_TRUE(statistics_proxy_->GetStats().bw_limited_resolution);
411 EXPECT_EQ(2, statistics_proxy_->GetStats().number_of_quality_adapt_changes);
412
413 statistics_proxy_->OnQualityRestrictedResolutionChanged(1);
414 EXPECT_TRUE(statistics_proxy_->GetStats().bw_limited_resolution);
415 EXPECT_EQ(3, statistics_proxy_->GetStats().number_of_quality_adapt_changes);
416
417 statistics_proxy_->OnQualityRestrictedResolutionChanged(0);
418 EXPECT_FALSE(statistics_proxy_->GetStats().bw_limited_resolution);
419 EXPECT_EQ(4, statistics_proxy_->GetStats().number_of_quality_adapt_changes);
420 }
421
388 TEST_F(SendStatisticsProxyTest, SwitchContentTypeUpdatesHistograms) { 422 TEST_F(SendStatisticsProxyTest, SwitchContentTypeUpdatesHistograms) {
389 for (int i = 0; i < SendStatisticsProxy::kMinRequiredMetricsSamples; ++i) 423 for (int i = 0; i < SendStatisticsProxy::kMinRequiredMetricsSamples; ++i)
390 statistics_proxy_->OnIncomingFrame(kWidth, kHeight); 424 statistics_proxy_->OnIncomingFrame(kWidth, kHeight);
391 425
392 // No switch, stats should not be updated. 426 // No switch, stats should not be updated.
393 VideoEncoderConfig config; 427 VideoEncoderConfig config;
394 config.content_type = VideoEncoderConfig::ContentType::kRealtimeVideo; 428 config.content_type = VideoEncoderConfig::ContentType::kRealtimeVideo;
395 statistics_proxy_->OnEncoderReconfigured(config, 50); 429 statistics_proxy_->OnEncoderReconfigured(config, 50);
396 EXPECT_EQ(0, metrics::NumSamples("WebRTC.Video.InputWidthInPixels")); 430 EXPECT_EQ(0, metrics::NumSamples("WebRTC.Video.InputWidthInPixels"));
397 431
(...skipping 964 matching lines...) Expand 10 before | Expand all | Expand 10 after
1362 fake_clock_.AdvanceTimeMilliseconds(kPeriodIntervalMs); 1396 fake_clock_.AdvanceTimeMilliseconds(kPeriodIntervalMs);
1363 proxy->DataCountersUpdated(counters, kFirstSsrc); 1397 proxy->DataCountersUpdated(counters, kFirstSsrc);
1364 } 1398 }
1365 1399
1366 // FEC not enabled. 1400 // FEC not enabled.
1367 statistics_proxy_.reset(); 1401 statistics_proxy_.reset();
1368 EXPECT_EQ(0, metrics::NumSamples("WebRTC.Video.FecBitrateSentInKbps")); 1402 EXPECT_EQ(0, metrics::NumSamples("WebRTC.Video.FecBitrateSentInKbps"));
1369 } 1403 }
1370 1404
1371 } // namespace webrtc 1405 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/video/send_statistics_proxy.cc ('k') | webrtc/video/vie_encoder_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698